Is there a way to use fnCellRender AND strip html?
Is there a way to use fnCellRender AND strip html?
Steve_Webtron
Posts: 19Questions: 0Answers: 0
When you export to csv, it strips all the html in the cells,
I would like to use fnCellRender to also replace some data
(like removeing BR's for excel's sake)
[code]
"fnCellRender": function ( sValue, iColumn, nTr, iDataIndex ) {
return '"'+sValue.replace(/
|/g,"\n")+'"';
}
[/code]
However this leaves me with all the nasty etc tags back in the data.
Is there a way to get the best of both worlds?
I would like to use fnCellRender to also replace some data
(like removeing BR's for excel's sake)
[code]
"fnCellRender": function ( sValue, iColumn, nTr, iDataIndex ) {
return '"'+sValue.replace(/
|/g,"\n")+'"';
}
[/code]
However this leaves me with all the nasty etc tags back in the data.
Is there a way to get the best of both worlds?
This discussion has been closed.
Replies
Allan
What we've been doing is going through several pages and adding dataTables class to the tables,
We then just initialize all the dataTables with that class when our "frame" loads.
Can I set this with javascript on a page by page basis?
Or would it just be safe to set all columns to html (because I'm finding anything and everything in these tables)
So the sType was already run?
if it was set with "aoColumnDefs": is is lost now?
Should I just find a way to put it inside the fnCellRender function?
Yes if you only have string data, no if you don't - since numbers wouldn't be sorted correctly.
> if it was set with "aoColumnDefs": is is lost now?
If set via sType then the automatic detection does not run and it just takes your value.
I'd say that mRender is probably a better solution for you here then fnCellRender . fnCellRender is really designed for added events etc to the created DOM element - while mRender is what does the formatting.
Allan
from excel exports to keep the data all in the same cell.
Thanks again though, I will look at mRender.
Since it is for Export, I believe that I may have to touch the underlying data... which mRender says it does not do.