Link to home
Start Free TrialLog in
Avatar of roy_sanu
roy_sanuFlag for India

asked on

jquery issue on display

I am using jQuery dataTable for pagination. In my example each page has check boxes for each line item. There is a 'Save' button in each page. So when I click the save button, it is saving only the checkbox selected in that page. If any checkbox in the previous page or in the next page are selected, those are not getting saved.

Is there any parameter (Options) which I need to pass so that it can retain the data from previous page. Please let me know if there is any other solution. Thank You.

$('#example').dataTable( {
        "bSort": true,
        "aaSorting": [[2,'asc'], [3,'desc']],  //[] will not perform initial sorting
        "aaSortingFixed": [[1,'asc']],
        "bAutoWidth": false,
} );
Avatar of Rob
Rob
Flag of Australia image

When you click to go to the next page, you need to save the currently clicked checkboxes for that page as hidden elements, web storage / localstorage or in a cookie.  You then combine this data with the current form before saving.

Hard to say much more without knowing what you've got and how you'd like to go about it.
I've been pondering on your question and I think the best approach is to automatically save the current page when the user clicks to the next or previous pages.  In otherwords, combine the javascript call to page next/prev with the save request.

By all means keep the save button as well.
ASKER CERTIFIED SOLUTION
Avatar of roy_sanu
roy_sanu
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of roy_sanu

ASKER

working fine