Welcome Guest, Not a member yet? Register   Sign In
Ignited DataTables

[eluser]iwizard[/eluser]
It worked!! Many thanks.. Smile

[eluser]ηυмвєяσηє[/eluser]
[quote author="ηυмвєяσηє" date="1309461805"]Ignited Datatables v0.5.3 released, added mDataProp support for Datatables v1.8.1+

Regards,
Yusuf[/quote]

'native php version' of the library updated to v0.5.3 as well.
https://github.com/n1crack/IgnitedDatata...hp-version

[eluser]cryogenix[/eluser]
i updated the first post as well to reflect yusuf's updates. sorry i've been inactive lately...

[eluser]LoganPHP[/eluser]
My Controller
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="'.site_url(" title="Edit" class="with-tip"><img src="'.base_url().'assets/backend/skin/images/icons/fugue/pencil.png" width="16" height="16"></a>&nbsp;&nbsp;<a href="" id="$1" title="Delete" class="with-tip delete"><img src="'.base_url().'assets/backend/skin/images/icons/fugue/cross-circle.png" width="16" height="16"></a>', 'q.id');
        echo $this->datatables->generate();

My view
Code:
'bProcessing'    : false,
                      'bServerSide'    : true,
                      'bAutoWidth'     : false,
                      'sAjaxSource'    : '&lt;?php echo site_url('backend/mahoney/poll_listener');?&gt;',
                      '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
Code:
GROUP_CONCAT(CONCAT(av.answer,av.vt) SEPARATOR ' ') AS ans

But i can't solve problem.Please help me

Thanks in advance,
Logan

[eluser]LoganPHP[/eluser]
This is my core query

Code:
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

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="'.site_url(" title="Edit" class="with-tip"><img src="'.base_url().'assets/backend/skin/images/icons/fugue/pencil.png" width="16" height="16"></a>&nbsp;&nbsp;<a href="" id="$1" title="Delete" class="with-tip delete"><img src="'.base_url().'assets/backend/skin/images/icons/fugue/cross-circle.png" width="16" height="16"></a>', 'q.id');
        echo $this->datatables->generate();
Here i have only one problem that is
Code:
GROUP BY q.id
.
How to add GROUP BY to ignited code?

[eluser]ηυмвєяσηє[/eluser]
i'm not sure it works. Can you try the codes below

Code:
$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');

[eluser]LoganPHP[/eluser]
Sorry it does not work.

[eluser]Irfan Cikoglu[/eluser]
Nice to see Turkish-made library on here Smile

[eluser]cipmang[/eluser]
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

Code:
&lt;?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

Code:
[removed]
$(document).ready(function() {
    $('#datasiswa').dataTable({
        'bServerSide'    : true,
        'bAutoWidth'     : false,
        'sPaginationType': 'full_numbers',
        'sAjaxSource': '&lt;?php echo site_url('main/datatabless');?&gt;',
        '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]
&lt;/head&gt;

&lt;body&gt;
<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 ?

[eluser]ηυмвєяσηє[/eluser]
controller :
Code:
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.




Theme © iAndrew 2016 - Forum software by © MyBB