Issue selecting rows that have not yet been rendered.
Issue selecting rows that have not yet been rendered.
weedweaver
Posts: 1Questions: 0Answers: 0
We have a table with items spanning across multiple pages. We have some functionality that selects rows based on a category (of sorts). To select items we pass an array of ids to a function which iterates over table.fnSettings().aoData and selects/de-selects items as appropriate. The selection code adds a class to the row i.e $(this.nTr).addClass('row_selected'). The issue I have is, If the row has not previously been rendered (if I haven't navigated to that page for example) then nTR is null so I cannot add the class to the row to highlight the fact that it is selected. What options do I have to get around this? Can I somehow tell the datatables to make sure nTR is always there (i.e. render everything intially) or are there options that when it finds an aodata object that has a null nTr to run the code to render it and ensure nTr is a row?
Thanks
Thanks
This discussion has been closed.
Replies
Don't enable deferred rendering - that will create all nodes needed for the table (unless your are using server-side processing, in which case state is held in your server-side script).
The way TableTools does this is to set a flag on the data source object for the row, and then apply that when he row is rendered. You might want to consider using that approach, or just using TableTools.
Allan