forcing fnRender to run
forcing fnRender to run
Hello,
I am using TableTools with a custom button to collect data from the table and send it to the server.
I'm fetching the data that I want to send to the server with something like this:
[code]TableTools.BUTTONS.download = {
"sAction": "text",
"sFieldBoundary": "",
"sFieldSeperator": "\t",
"sNewLine": "
",
"sToolTip": "",
"sButtonClass": "DTTT_button_text",
"sButtonClassHover": "DTTT_button_text_hover",
"sButtonText": "Download",
"mColumns": "visible",
"bHeader": false,
"bFooter": false,
"sDiv": "",
"fnMouseover": null,
"fnMouseout": null,
"fnClick": function( nButton, oConfig ) {
var oParams = this.s.dt.oApi._fnAjaxParameters( this.s.dt );
var dataPost = this.fnGetTableData(oConfig);
... (send the contents of dataPost to the server) ...
[/code]
What I am finding is that the data that is returned by this.fnGetTableData(oConfig) is different depending on whether or not the row in question has been rendered. Since I am using pagination, only one page (in my case, 12 of the 50 rows) has been rendered. The data that gets collected into dataPost looks different for the first 12 results versus the next 38 results.
If I click "Next Page", and then use my TableTools custom button, the data for the first 24 results looks different than the remaining 26. So I am definitely seeing that the data returned by fnGetTableData is different based on whether or not the row has been rendered.
Is there a way to force dataTables to render the row internally, so its cache has the rendered value? I actually really only want to render a single column in each row, but I might be forced to render all of them. I still want to use bDeferRender, since the rendering can be slow, and most users are not clicking this TableTools button anyway.
Thanks for any thoughts on this matter.
I am using TableTools with a custom button to collect data from the table and send it to the server.
I'm fetching the data that I want to send to the server with something like this:
[code]TableTools.BUTTONS.download = {
"sAction": "text",
"sFieldBoundary": "",
"sFieldSeperator": "\t",
"sNewLine": "
",
"sToolTip": "",
"sButtonClass": "DTTT_button_text",
"sButtonClassHover": "DTTT_button_text_hover",
"sButtonText": "Download",
"mColumns": "visible",
"bHeader": false,
"bFooter": false,
"sDiv": "",
"fnMouseover": null,
"fnMouseout": null,
"fnClick": function( nButton, oConfig ) {
var oParams = this.s.dt.oApi._fnAjaxParameters( this.s.dt );
var dataPost = this.fnGetTableData(oConfig);
... (send the contents of dataPost to the server) ...
[/code]
What I am finding is that the data that is returned by this.fnGetTableData(oConfig) is different depending on whether or not the row in question has been rendered. Since I am using pagination, only one page (in my case, 12 of the 50 rows) has been rendered. The data that gets collected into dataPost looks different for the first 12 results versus the next 38 results.
If I click "Next Page", and then use my TableTools custom button, the data for the first 24 results looks different than the remaining 26. So I am definitely seeing that the data returned by fnGetTableData is different based on whether or not the row has been rendered.
Is there a way to force dataTables to render the row internally, so its cache has the rendered value? I actually really only want to render a single column in each row, but I might be forced to render all of them. I still want to use bDeferRender, since the rendering can be slow, and most users are not clicking this TableTools button anyway.
Thanks for any thoughts on this matter.
This discussion has been closed.
Replies
[code] 'fnCreatedCell': function (nTd, sData, oData, iRow, iCol) {
oData['details'] = oData['dataId'];[/code]
And that isn't being run unless the cell gets rendered. So I need to figure out how to have a function that executes that bit of logic that can be run either when I run my TableTools fnClick (for all rows) or from fnCreatedCell (during the rendering process).
I found that I wasn't actually looking to run the rendering code, but that I needed a side effect of the rendering that was in a custom fnCreatedCell . Added the relevant code into a loop in the success callback of my $.ajax call.
Tried to delete this whole topic but found no option to do so.