Changing pages automatically unchecks checked boxes in column (Chrome, Firefox, Safari tested)

Changing pages automatically unchecks checked boxes in column (Chrome, Firefox, Safari tested)

luv_datatablesluv_datatables Posts: 4Questions: 0Answers: 0
edited January 2013 in Bug reports
Hi,

I have a table (server-side populated) with a checkbox column. By default, they're set to unchecked. The problem is, when I check the boxes and change pages, the datatable does not preserve which boxes are checked. So, the checked boxes on page 1 become unchecked when moving to page 2.

[code]

$('#my_table').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
"bjQueryUI": true,

// loading with flask and mongodb
"sAjaxSource": $SCRIPT_ROOT + "/_load_my_table",
"aoColumns": [
null,
null,
null,
null,
null,
null,
null,
{"bSortable": false,
"bVisible": true,
"sClass": 'center'}
],

"oLanguage": {
"sSearch": ""

},
"sDom": 'lf<"toolbar"><"top">rt<"bottom">ip<"clear">'

} );
// custom styling
$('.dataTables_filter input').attr("placeholder", "Filter Results...").attr("class", "datatables_custom_filter");
// tags that add buttons to the toolbar
$("div.toolbar").html('...');

[/code]

Any thoughts? I looked around and I know this is a well-known problem on IE6, but I don't see any current issues regarding this.

Best,
Rob

Replies

  • luv_datatablesluv_datatables Posts: 4Questions: 0Answers: 0
    edited January 2013
    I'm trying to work on a plugin to fix this unless on already exists
  • allanallan Posts: 63,685Questions: 1Answers: 10,498 Site admin
    > "bServerSide": true

    That's the problem. The state is not saved on the client-side - so the rows are destroyed and recreated on each draw.

    Do you really need server-side processing? Can you use Ajax loading with deferred rendering?

    Allan
  • luv_datatablesluv_datatables Posts: 4Questions: 0Answers: 0
    edited January 2013
    Hi Allan,

    Thanks for your reply. I'm assumed I would need server-side processing since the table will potentially grow to 50,000 records. I can try Ajax loading with deferred rendering if 50,000 records will be easily handled.

    Edit:

    Deferred rendering works well - I'm a little concerned about the on page load speed for ~10^4 records , but it seems like a solid solution until I work on a plugin to preserve state.
  • allanallan Posts: 63,685Questions: 1Answers: 10,498 Site admin
    50'000 rows is around about the point to start looking at server-side processing: http://datatables.net/faqs#speed .

    You'll also still find that check all won't work perhaps quite as you had fully expected since you are checking nodes which have been created only, but deferred rendering obviously doesn't create all nodes.

    The only real way around it is to use a flag that is not a DOM node (i.e. use a property of the data source object). Or if you use server-side processing, you need to have the server-side keep state, which is a bit of a pain!

    Allan
  • mattnthatmattnthat Posts: 18Questions: 0Answers: 0
    Any examples available on getting this happening:
    [quote] The only real way around it is to use a flag that is not a DOM node (i.e. use a property of the data source object). [/quote]
    Flag to work.
    Ive had to disable deferred render to get checkall/code working.

    Thanks,
    Matt
This discussion has been closed.