state save is not working with compatibility view

state save is not working with compatibility view

karamkaram Posts: 31Questions: 14Answers: 0
edited September 2015 in Free community support

I am using 1.10.2 version . my code is below its working without compatibility view only.

$(document).ready(function() {
var table;
// DataTable
table = $('#example').dataTable({
"processing": true,
stateSave: true,
"deferRender": true, // to make the search fast

         "dom": 'C<"clear">Rfltipr', // for column Re-odering and column visibilty.  

         "ajax": {
             "url": "/my/example.so",
             "type": "GET"
         },
         "columns": [{
             "title": "name",
             "data": "name",
             "name": "name"
         }, {
             "title": "addeddate",
             "data": "addeddate",
             "name": "added date"
         }]
     });
     table.columnFilter({
             sPlaceHolder: "head:before",
             aoColumns: [{
                     type: "text"
                 }, {
                     type: "date-range",
                     bRegex: true,
                     bSmart: true
                 }
             }
         ]
     }); $.datepicker.regional[""].dateFormat = 'yy-mm-dd'; $.datepicker.setDefaults($.datepicker.regional['']);

second script that I was using to individual column search is this :
DATATBLE CODE here //

Setup - add a text input to each footer cell
var noofcolumn= $('#example'thead th').length;
colmn="";

                for(i=0; i<noofcolumn; i++)
                {
                var title = $('#example'thead th').eq( i ).text();
                colmn+='<th><input type="text" placeholder="Search '+title+'" /></th>';
                }
                $('#example'tfoot').html( colmn );


             // Apply the search

                table.columns().every( function ()
                        {
                $('input', this.footer() ).on( 'keyup change', function () {
                    table
                        .column( $(this).parent().index()+':visible' )
                        .search( this.value )
                        .draw();

                } );

    });

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,356Questions: 1Answers: 10,444 Site admin

    Does compatibility view support localStorage? If not, that's the issue.

    In general, DataTables is not supported in compatibility view.

    Allan

  • karamkaram Posts: 31Questions: 14Answers: 0
    edited September 2015

    except state save everything else in my code is working with compatibility view as well and my problem is state save is not saving filter textboxes , but its saving only columns header and data. can you help me in that ?? I want everything working without compatibility view . so state save is conflicting with column reordering somehow and when I am changing the order it does not save state of filters in the next login

  • allanallan Posts: 63,356Questions: 1Answers: 10,444 Site admin
    Answer ✓

    Oh I see - this is an issue with the columnFilter plug-in? If so, that is a third party library and not supported by myself. You would need to ask its author.

    Allan

  • karamkaram Posts: 31Questions: 14Answers: 0

    I have been using that plugin because I didn't find any example in data tables which can support individual column search according to type as I have date-column . do u have any solution for this .

  • karamkaram Posts: 31Questions: 14Answers: 0

    I added one more script in question can u please see and tell me how can I add date columns in that such that I can get two search boxes on individual column search.

  • allanallan Posts: 63,356Questions: 1Answers: 10,444 Site admin
    Answer ✓

    individual column search according to type as I have date-column . do u have any solution for this .

    There isn't a pre-built library for this as part of the DataTables software at the moment. It is something I will add in future.

    I added one more script in question can u please see and tell me how can I add date columns in that such that I can get two search boxes on individual column search.

    A custom search plug-in would be required for that.

    Allan

This discussion has been closed.