Responsive extension and render
Responsive extension and render
jd0000
Posts: 25Questions: 6Answers: 0
In the responsive extension, I'm trying to use (either the default or ) a custom render function. I seem to only be able to get the raw data. How do I reference either the rendered data directly (that uses my column's rendering function), or get access to the columns rendering function from within { responsive: { details: { renderer: function } } } to render the raw data?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
The
row().cache()
method will let you access the data that has been cached for searching and / or ordering. In this case, you probably want to access the search cache (since the ordering data might not be available if the column hasn't been ordered).Allan
So if i edit your rendered function for testing i get ...
What i get for output is
So i'm not sure if I'm doing something wrong or its not working.
And I'm apparently incapable of learning how to use markdown for formatting.
I created an example here:
http://live.datatables.net/xemoney/1/edit?html,js,console,output
I'm not sure how to access the row.cache from there --- unlike my local test, which outputs null, when i write out the row cache here it prints out i think the whole dataTables object (and slows jsbin to a crawl). Is there anyway in this example for me to get it to render like it should with the RENDER whatever?
(Thank you!)
Hi,
Your Markdown was fine :-). The only thing is to get a line break, use a double space at the end of a line (thinking of changing the Markdown used here to do that automatically...).
Thanks for the live example. I used
api.cell( cell ).cache('search')
in it and it appears to do what is required I think: http://live.datatables.net/xemoney/2/edit . Is that what you are looking for?Allan
Yes thats exactly what I was looking for.
Unfortunately, while it works on the live datatables site, it doesnt work on my code. I have a convoluted way of creating the datatables initialization options object so maybe its something i did wrong in there. With the only change being ( "api.cell( cell ).cache('search')" replacing "api.cell( cell ).data()"), when I go to expand the row I now get
TypeError: settings.aoData[row][type] is null
return settings.aoData[ row ][ type ][ column ];
on line 8373 - which is in the api_registerPlural function for cells().cache.
When debugging and looking at the object, for each row in aoData, _aSortData, _aFilterData, and _sFilterRow are null.
I'll keep playing with different options on my site to see what i can figure out.
Thanks for taking a look.
Are you using server-side processing or something else perhaps?
Allan
Yes this is server-side. i msged over the debug page (btw, i dont think the debug page recognizes Responsive yet)
Good point about the debug page - had forgotten to update it!
Thanks for the debug trace. The problem is that you are using server-side processing. Since server-side processing is used there is no filtering at the client-side, so there is no cached data.
In which case, the only want to get the rendered text is to read it from the document -
$( api.cell( cell ).node() ).html();
would do it.Allan
That was it. perfect. thanks again!
Hi Allan,
Thank you for your answers...You are really great.
I set the DT in our dev server both with server and client side. We choose for the moment the client side option. But in the responsive design (with client side) I used the node().html option and it is working only in the first page results. Is this because the page is cached? Can I somehow have the same cached data in all pagination pages?
I have a custom rendering row via fnRowCallback. I have some checks and I output a link with the button in the last column.
The next page (and all the pages) the hide cells are using the data before the custom rendering (for example in last cell I get ColumnName : 1 ...
In the example with the server side processing is working fine in all pages...
Not sure, can you link to the page please. You might have deferred rendering enabled.
Allan