Ajax DataTable inside Jquery Tab returns all rows as selected

Ajax DataTable inside Jquery Tab returns all rows as selected

khalidmrukhalidmru Posts: 4Questions: 1Answers: 0

Hi,

I am fairly new to DataTables and still finding my feet. I have come across an issue with which I require assistance. I have a page with 2 jquery tabs. Inside each tab, exist an ajax sourced DataTable.

The Issue:
When I do a count to determine the number of selected rows, DataTables always returns all rows in dataset as selected.

Please see the test case at : http://[live.datatables.net/kilaneke/1/edit] . In the 2nd Tab "VENDORS" , click the "ADD VENDOR" button. This will log a count of the number of selected rows to the console.

As you can see it shows all 57 rows as selected.

Kindly advise a solution on how to solve this issue or any suitable workaround.

Regards,

This question has an accepted answers - jump to answer

Answers

  • khalidmrukhalidmru Posts: 4Questions: 1Answers: 0
  • khalidmrukhalidmru Posts: 4Questions: 1Answers: 0

    Just an update..all the controls..search..col reorder work fine

  • khalidmrukhalidmru Posts: 4Questions: 1Answers: 0

    For those whom this may be of assistance; instead of(which works fine outside jquery tabs):

    table.rows({ selected: true }).every(function(index){
                    // Get and store row ID
                    data.push(this.data()[0]);
                    $count++;
                    });
    

    Use the following method;

     table.rows('.selected').every(function(index){
                        // Get and store row ID
                        data.push(this.data()[0]);
                        $count++;
                    });
    

    The developers of the plugin may provide us with some insight as to why the second method works inside tabs

  • allanallan Posts: 63,302Questions: 1Answers: 10,431 Site admin
    Answer ✓

    You don't have the Select extension installed, which is why there is no row selection and the selected modifier has no effect.

    Adding it allows it to work as expected.

    Allan

This discussion has been closed.