Oudated Ignited Datatables

Oudated Ignited Datatables

AfiqAbdullahAfiqAbdullah Posts: 5Questions: 0Answers: 0

Hi I try to use Ignited Datatables from https://github.com/IgnitedDatatables/Ignited-Datatables

And I'm using DataTables 1.10.7.
It seems datatables parameter name sent to server changes a lot.

Is there any libraries/fix for me to work with codeigniter framework?

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited August 2015

    You would need to ask Ignited's author about an update.

    Alternatively you could try to fix it yourself using DT's upgrade conversion guide: https://www.datatables.net/upgrade/1.10-convert

  • allanallan Posts: 63,696Questions: 1Answers: 10,500 Site admin

    There is an option to use the legacy parameters.

    Allan

  • AfiqAbdullahAfiqAbdullah Posts: 5Questions: 0Answers: 0

    Alright, thanks for the info. I will try what you all suggest.

  • AfiqAbdullahAfiqAbdullah Posts: 5Questions: 0Answers: 0
    edited August 2015
    $.fn.dataTable.ext.legacy.ajax = true;
        $('#example').dataTable( {
            "processing": true,
            "serverSide": true,
            "aoColumns" : [
                { "mData": "fullname" },
                { "mData": "order" },
                { "mData": "level" },
                { "mData": "certificate" },
                { "mData": "course name" },
                { "mData": "sequence" }
    
            ],
    
            "aoColumnDefs": [
                  { "sName": "fullname", "aTargets": [ 0 ] },
                  { "sName": "order", "aTargets": [ 1 ] },
                  { "sName": "level", "aTargets": [ 2 ] },
                  { "sName": "certificate", "aTargets": [ 3 ] },
                  { "sName": "course name", "aTargets": [ 4 ] },
                  { "sName": "sequence", "aTargets": [ 5 ] }
            ],
            
            
            "sAjaxSource": base_url + '/student_getdata',
    
            "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
                
                oSettings.jqXHR = $.ajax( {
                                        "dataType": 'json',
                                        "type": "POST",
                                        "url": sSource,
                                        "data": aoData,
                                        "success": fnCallback,
                                        "error": function (e) {
                                            console.log(e.message);
                                        }
    
                });
                
            }
    

    Here my code, unfortunately the parameter names still send a new one.

    Please guide me if I made mistake somewhere.

  • AfiqAbdullahAfiqAbdullah Posts: 5Questions: 0Answers: 0
    edited August 2015
    $.fn.dataTable.ext.legacy.ajax = false;
        $('#example').dataTable( {
            "bprocessing": true,
            "bserverSide": true,
            "aoColumns" : [
                { "mData": "fullname" },
                { "mData": "order" },
                { "mData": "level" },
                { "mData": "certificate" },
                { "mData": "course name" },
                { "mData": "sequence" }
     
            ],
     
            "aoColumnDefs": [
                  { "sName": "fullname", "aTargets": [ 0 ] },
                  { "sName": "order", "aTargets": [ 1 ] },
                  { "sName": "level", "aTargets": [ 2 ] },
                  { "sName": "certificate", "aTargets": [ 3 ] },
                  { "sName": "course name", "aTargets": [ 4 ] },
                  { "sName": "sequence", "aTargets": [ 5 ] }
            ],
             
             
            "sAjaxSource": base_url + '/student_getdata',
     
            "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
                 
                oSettings.jqXHR = $.ajax( {
                                        "dataType": 'json',
                                        "type": "POST",
                                        "url": sSource,
                                        "data": aoData,
                                        "success": fnCallback,
                                        "error": function (e) {
                                            console.log(e.message);
                                        }
     
                });
                 
            }
    

    I manage to make the datatables sent old parameter names by:
    $.fn.dataTable.ext.legacy.ajax = false;

    but the output are.

    {"draw":"1","columns":"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]","order":"[object Object]","start":"0","length":"10","search":"[object Object]"}

    Why it show [Object]?

  • allanallan Posts: 63,696Questions: 1Answers: 10,500 Site admin

    I would suggest not using fnSeverData here. If you want to use POST with the legacy options use the sServerMethod option. Also the parameters you have are the new ones. You need to use $.fn.dataTable.ext.legacy.ajax = true;

    If that does not work, please link to a test case showing the issue.

  • AfiqAbdullahAfiqAbdullah Posts: 5Questions: 0Answers: 0
    edited August 2015
    $(document).ready(function() {
        $.fn.dataTable.ext.legacy.ajax = false;
        $('#example').dataTable( {
            "processing": true,
            "serverSide": true,
            "columns" : [
                { "data": "fullname" },
                { "data": "order" },
                { "data": "level" },
                { "data": "certificate" },
                { "data": "course name" },
                { "data": "sequence" }
    
            ],
            "columnDefs": [
                  { "sName": "fullname", "aTargets": [ 0 ] },
                  { "sName": "order", "aTargets": [ 1 ] },
                  { "sName": "level", "aTargets": [ 2 ] },
                  { "sName": "certificate", "aTargets": [ 3 ] },
                  { "sName": "course name", "aTargets": [ 4 ] },
                  { "sName": "sequence", "aTargets": [ 5 ] }
            ],
    
            "ajax": function (data, callback, settings) {
                settings.jqXHR = $.ajax( {
                                        "dataType": 'json',
                                        "url": base_url + 'student_getdata',
                                        "type": "POST",
                                        "data": data,
                                        "success": callback,
                                        "error": function (e) {
                                            console.log(e.message);
                                        }
                });
              });
    });
    

    Finally I find the solution, this code works like charms. with
    $.fn.dataTable.ext.legacy.ajax = false;

    Thank you for your support.
    If there have any better solution . please let me know.

    How can i submit an issue? Guide me please

  • allanallan Posts: 63,696Questions: 1Answers: 10,500 Site admin

    Issues can be submitted here in the forum, with a link to a test case showing the issue.

    Allan

This discussion has been closed.