How does jQuery.dataTable () hide strings?

I came across strange behavior when using the jQuery + dataTables plugin.

Let's say I have the following table:

<table id="myTable">
    <thead>
        <th>col 0</th>
        <th>col 1</th>
    </thead>
    <tbody>
        <tr>
            <td><input type="checkbox" /></td>
            ...
        </tr>
        ...
    </tbody>
</table>

I call $('#myTable').dataTable({...});on document.ready and want to get all the lines that checked the input when I click the button (even if they are not on the current page of the table).

To get all the rows (including unverified ones), I use $('#myTable').dataTable().fnGetNodes()( API-Link ), which returns an array with all these tr-nodes. After that I use this array to create a jQuery object:

var nodearray = $('#myTable').dataTable().fnGetNodes();
var trs = $(nodearray);

Here is the part that I do not understand. I tried two ways to get all checked nodes, but the results were different:

// returns all rows correctly (including invisible rows from other pages)
trs.find('td input:checked').closest('tr'); 

// return only rows from the current page
trs.has('td input:checked');

DataTables, , jQuery.has() jQuery.find() ?

PS:

+4
1

DOM, , DOM, , DOM .

, , jQuery 1.8.x, , , .

, has, in-memory 1.8.x:

console.log($('<div><span></span></div>').has('span').length); //0

EDIT: , : http://bugs.jquery.com/ticket/11543

+3

All Articles