How update tr data attribute on other page
How update tr data attribute on other page
ambo
Posts: 4Questions: 0Answers: 0
Hi all !
I need update all <tr> attribute data-id on my big table dinamically.
next code work only on the current page:
mainTable.row(index).node().getAttribute('data-id') - i get data if i have index on current page, because it's node().
Help me, how i can get(set) date on other page?
This discussion has been closed.
Replies
rows()
will let you select rows for all pages.If that doesn't help, can you link to an example of what you mean, as I'm not 100% sure I understand.
Allan
rows() will get only records of current page... I wanna get all nodes, for all pages.
<tr data-id="123"><td>...</td></tr>
<tr data-id="323"><td>...</td></tr>
...
<tr data-id="623"><td>...</td></tr>
I must change all "data" attribute for all records (on the all pages)
You can restrict
rows()
to return rows for the current page, by default it returns rows for all pages - not just the current page.Colin
Thanks!
But how i get all <tr> data-attribute (not for current page)?
If row(index).node() to return element only for the current page.
As example, i want change data-id attribute for row with index=25 (that is on page number 3), current page has number 1.
row(index).node().getAttribute('id') - cannot find this element (logic )
row(index).node().getAttribute('id'), if index = 3 on the page=1, found it
I need change data-id if current page is 1 but element is on 3 page.
You can get them all with
rows().node()
- note you are usingrow()
, notrows()
,Colin
Thnx.
But i wanna get data from not current page.
rows().nodes() - get all dom-element from current page.
My table consist data-attribute into <tr> tags.
And i need change this.
Is has DataTable other api for change data-attribute parameters?
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Are you using server side processing or
deferRender
? If so that is why.This example shows that
rows().nodes()
works with all the rendered data in the client:http://live.datatables.net/nozugame/1/edit
Kevin
Another option might be to use
createdRow
to update the data attributes.As Colin mentioned the best way for us to help is to provide a test case showing what you have and what you are trying to do.
Kevin