ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Ignited DataTables

July 15, 2010 2:51am

Subscribe [119]
  • #181 / Jul 01, 2011 6:24am

    iwizard

    3 posts

    It worked!! Many thanks..  😊

  • #182 / Jul 04, 2011 6:35am

    ηυмвєяσηє

    109 posts

    Ignited Datatables v0.5.3 released, added mDataProp support for Datatables v1.8.1+

    Regards,
    Yusuf

    ‘native php version’ of the library updated to v0.5.3 as well.
    https://github.com/n1crack/IgnitedDatatables-native-php-version

  • #183 / Jul 05, 2011 12:16am

    cryogenix

    90 posts

    i updated the first post as well to reflect yusuf’s updates. sorry i’ve been inactive lately…

  • #184 / Jul 06, 2011 1:36pm

    LoganPHP

    15 posts

    My Controller

    $this->load->library('datatables');
            $this->datatables
                ->select("q.id,q.question,q.status,GROUP_CONCAT(CONCAT(av.answer,av.vt) SEPARATOR ' ') AS ans",FALSE)
                ->from('tb_poll AS q')
                ->join('(SELECT a.answer,a.poll_id,COUNT(v.id) AS vt FROM tb_poll_answers AS a LEFT JOIN tb_poll_votes AS v ON a.id=v.poll_answer_id) AS av','q.id=av.poll_id','left')
                ->add_column('action', '<a href="http://%27.site_url" title="Edit" class="with-tip">'.base_url().</a>  <a href="http://" title="Delete" class="with-tip delete">'.base_url().</a>', 'q.id');
            echo $this->datatables->generate();

    My view

    'bProcessing'    : false,
                          'bServerSide'    : true,
                          'bAutoWidth'     : false,
                          'sAjaxSource'    : '<?php echo site_url('backend/mahoney/poll_listener');?>',
                          'aoColumns' : [
                                { 'sName': 'q.id','bVisible': false},
                                { 'sName': 'q.question'},
                                { 'sName': 'q.status'},
                                { 'sName': 'ans'},
                                { 'sName': 'action',"bSearchable": false}
                            ],
                           'fnServerData': function(sSource, aoData, fnCallback)
                          {
                            $.ajax
                            ({
                              'dataType': 'json',
                              'type'    : 'POST',
                              'url'     : sSource,
                              'data'    : aoData,
                              'success' : fnCallback
                            });

    Here i am getting undefined column result.
    I guessed problem in

    GROUP_CONCAT(CONCAT(av.answer,av.vt) SEPARATOR ' ') AS ans

    But i can’t solve problem.Please help me

    Thanks in advance,
    Logan

  • #185 / Jul 06, 2011 1:39pm

    LoganPHP

    15 posts

    This is my core query

    SELECT q.id,q.question,av.vt,GROUP_CONCAT(CONCAT(av.answer,av.vt) SEPARATOR ' ') AS Answers FROM tb_poll AS q LEFT JOIN
    (SELECT a.answer,a.poll_id,COUNT(v.id) AS vt FROM tb_poll_answers AS a LEFT JOIN tb_poll_votes AS v ON a.id=v.poll_answer_id GROUP BY a.id) AS av
    ON q.id=av.poll_id
    GROUP BY q.id

    I have used as ignited code like following code

    $this->load->library('datatables');
            $this->datatables
                ->select("q.id,q.question,q.status,GROUP_CONCAT(CONCAT(av.answer,av.vt) SEPARATOR ' ') AS ans",FALSE)
                ->from('tb_poll AS q')
                ->join('(SELECT a.answer,a.poll_id,COUNT(v.id) AS vt FROM tb_poll_answers AS a LEFT JOIN tb_poll_votes AS v ON a.id=v.poll_answer_id) AS av','q.id=av.poll_id','left')
                ->add_column('action', '<a href="http://%27.site_url" title="Edit" class="with-tip">'.base_url().</a>  <a href="http://" title="Delete" class="with-tip delete">'.base_url().</a>', 'q.id');
            echo $this->datatables->generate();

    Here i have only one problem that is

    GROUP BY q.id

    .
    How to add GROUP BY to ignited code?

  • #186 / Jul 06, 2011 2:02pm

    ηυмвєяσηє

    109 posts

    i’m not sure it works. Can you try the codes below

    $this->load->library("Datatables");
    $this->datatables
     ->select('id, question, vt, answers')
     ->from("(SELECT q.id,q.question,av.vt,GROUP_CONCAT(CONCAT(av.answer,av.vt) SEPARATOR ' ') AS answers 
              FROM tb_poll AS q 
              LEFT JOIN (SELECT a.answer,a.poll_id,COUNT(v.id) AS vt FROM tb_poll_answers AS a LEFT JOIN tb_poll_votes AS v ON a.id=v.poll_answer_id GROUP BY a.id) AS av ON q.id=av.poll_id
              GROUP BY q.id) as mytable");
     ->add_column('action', 'actionlinks $1', 'id');
  • #187 / Jul 07, 2011 2:00am

    LoganPHP

    15 posts

    Sorry it does not work.

  • #188 / Jul 07, 2011 2:06pm

    Irfan Cikoglu

    38 posts

    Nice to see Turkish-made library on here 😊

  • #189 / Jul 14, 2011 7:15am

    cipmang

    6 posts

    dear all,

    i have read the disscuss from beginning, but my application still doesnt display anything,..

    i use ignited-datatables ver. 0.5.3 and datatables 1.8.1

    this is my code controller main.php

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Main extends CI_Controller {
    
        function __construct()
        {
            parent::__construct();
        }
        
        function index()
        {
            $this->load->view('vmain');
        }
        
        function ckeditor()
        {
            $this->load->view('vckeditor');
        }
        
        function datatabless()
        {
            $this->load->library('datatables');
            $this->datatables
                ->select('nim, nama, kelas, telp, alamat')
                ->from('data');
    
              $data['result'] = $this->datatables->generate();
              $this->load->view('vdatatables', $data);
           }
    }

    and this is my view, vdatatables.php

    [removed]
    $(document).ready(function() {
        $('#datasiswa').dataTable({
            'bServerSide'    : true,
            'bAutoWidth'     : false,
            'sPaginationType': 'full_numbers',
            'sAjaxSource': '<?php echo site_url('main/datatabless');?>',
            'aoColumns' : [
                { 'sName': 'nim'},
                { 'sName': 'nama'},
                { 'sName': 'kelas'},
                { 'sName': 'telp' },
                { 'sName': 'alamat' },
            ],
            'fnServerData': function(sSource, aoData, fnCallback){
                $.ajax({
                    'dataType': 'json',
                    'type': 'POST',
                    'url': sSource,
                    'data': aoData,
                    'success': fnCallback
                });
            },
        });
    });
    [removed]
    </head>
    
    <body>
    <table border="0" cellpadding="4" cellspacing="0" class="display" id="datasiswa">
    <thead>
        <tr>
            <th width="10%">NIM</th>
            <th width="55%">Nama</th>
            <th width="10%">Kelas</th>
            <th width="10%">Telepon</th>
            <th width="15%">Alamat</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>loading…</td>
        </tr>
    </tbody>
    </table>

    when i echo the $result, the result is still array, what happened with this ?

  • #190 / Jul 14, 2011 7:22am

    ηυмвєяσηє

    109 posts

    controller :

    function datatabless()
        {
          $this->load->library('datatables');
          $this->datatables
            ->select('nim, nama, kelas, telp, alamat')
            ->from('data');
    
            echo $this->datatables->generate();
        }
        function showpage()
        {
          $this->load->view('vdatatables');
        }

    and go to main/showpage..
    datatabless is your ajax listener and its output will be array.

  • #191 / Jul 14, 2011 7:30am

    cipmang

    6 posts

    controller :

    function datatabless()
        {
          $this->load->library('datatables');
          $this->datatables
            ->select('nim, nama, kelas, telp, alamat')
            ->from('data');
    
            echo $this->datatables->generate();
        }
        function showpage()
        {
          $this->load->view('vdatatables');
        }

    and go to main/showpage..
    datatabless is your ajax listener and its output will be array.

    thanks a lot ηυмвєяσηє,
    yeah,.....
    i like this share…
    i’ll share it to with other people…

  • #192 / Jul 16, 2011 8:01am

    meddiecap

    3 posts

    Hi,

    Wow, very sweet class! I’m playing with it a bit trying to get searching per column working. I’m getting this error:

    Call to a member function where() on a non-object [..] on line 236, when using

    "aoSearchCols": [
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        { "sSearch": "My filter" },
        null,
        { "sSearch": "^[0-9]", "bEscapeRegex": false }
    ]

    (i have 12 columns)

    It concerns this line:

    $this->ar->where($this->select[$mColArray[$i]].' like', '%'.$this->ci->input->post('sSearch_' . $i).'%');

    I’m using the current version of Datatables.php

    Hope you can help!
    Thanks

  • #193 / Jul 16, 2011 8:20am

    ηυмвєяσηє

    109 posts

    Hi,

    Thanks for that. Now it fixed on github.

    Im afraid, regular expressions on filtering are not supported by the library at the moment.

    Regards,
    Yusuf

  • #194 / Jul 18, 2011 11:38am

    pmsfo

    13 posts

    Just Added Group By Fuction to datatables, it works for me.

    protected $groupbys        = array();
    
    /**
        * Generates the Group By portion of the query
        *
        * @param string $tables
        * @return mixed
        */
        public function group_by($tables)
        {
          $this->groupbys[] = $tables;
          $this->ci->db->group_by($tables);
          return $this;
        }

    Now you can use

    $this->datatables->group_by(‘job.jobid,job.name,job.starttime,job.endtime,
                      job.jobfiles,job.jobbytes,job.jobstatus,job.level,
                      jobmedia.mediaid,media.volumename’);

    Signature
    ______________________________________________
    http://www.newitperson.com
    http://www.newitperson.com/reportula

  • #195 / Jul 18, 2011 12:04pm

    pmsfo

    13 posts

    How Can I do this, change the value of column to image by if clause example:

    if ($row['jobstatus'] == "T" ){
                     
                    $row['jobstatus']= ("".base_url().");
                }else if ($row['jobstatus'] == "A" ) {
                    $row['jobstatus']= ("".base_url().");
                 }else  {  
                    
                    $row['jobstatus']= ("".base_url().");
                }
                if ($row['level'] == "I" ){
                    $row['level']= ("".base_url().");
                }else{
                    $row['level']= ("".base_url().");


    How i can do this with the library ?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases