Modify TD in only rows that are visible due to pagination

Modify TD in only rows that are visible due to pagination

Starz26Starz26 Posts: 38Questions: 1Answers: 0
edited November 2013 in General
I have tried to piece together the various options to accomplish this but I cannot get past modifying all rows.

I have a check box in column (0), 12 rows, and Show set to (10).

I want to check the checkbox for only the 10 rows that are visible.

Here is what I am currently doing:

[code]oTable.$('input', {filter:'applied'}).prop( 'checked', true);[/code]

I need to get this selection down to only the visible rows. It works when filters are applied obviously, but how do I select only the rows visible due to pagination.

Thanks.

Replies

  • Starz26Starz26 Posts: 38Questions: 1Answers: 0
    I tried

    [code] var data = oTable._('tr', {filter: 'applied'});[/code]

    as well but the array still included all rows since there were no filters applied, just the pagination set to 10
  • Starz26Starz26 Posts: 38Questions: 1Answers: 0
    Disregard.

    I had to select the actual table in the dom and not the datatable....
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I think your original statement was very close, but you want to use: `{page:'current'}` to get the current page - i.e.:

    [code]
    oTable.$('input', {page:'current'}).prop( 'checked', true);
    [/code]

    Doc for the options here: http://datatables.net/docs/DataTables/1.9.4/#$ . This will be much better documented for 1.10, the documentation for which I've been working on recently.

    Allan
This discussion has been closed.