3

I am using jQuery datatable to bind an asp.net gridview and I have to hide and show some rows.

It is working perfect but when I hide some rows from datatable the datatable paging is not updating so I have to rebind jquery datatable.

When I call the datatable function again it shows this error :-

enter image description here

I am using this code to show and hide..then rebind datatable

$('table.dataTable tbody tr').each(function () {
                var name = $(this).find('.name').html();
                if (name == str) {
                    $(this).show();
                    $('.Flight_class').dataTable({
                        "aaSorting": [[1, "asc"]],
                        "sPaginationType": "full_numbers",
                        "bJQueryUI": false,
                        "bAutoWidth": false,
                        "bLengthChange": false
                    });
                }
                else {
                    $(this).hide();
                }
            });

1 Answer 1

1

I don't think it is not possible to rebind datatable. Unbind it before rebinding:

$('.Flight_class').unbind().dataTable({...});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.