Fetching raw data and rendering differently with serverside processing
Fetching raw data and rendering differently with serverside processing
I think fnGetData should always return the raw data that was fetched from the serverside script. Now it seems to be affected by fnRender callbacks which I would imagine by it's name to only affect the rendering of the data which doesn't seem to be the case.
I was using fnRender to add some html to some columns, but when I needed to use the original data in javascript afterwards, I noticed that it was not possible using fnGetData since it is affected by fnRender. I think this should be changed so fnRender doesn't affect fnGetData or for preserving backwards compatibility we would need a new function for example fnGetRawData.
If this is the intended behaviour, the documentation and naming of these methods and callbacks could be better.
For now I found out a workaround I can use. Instead of using fnRender, I use fnRowCallback to modify each row. This way fnGetData will still return the raw data.
I was using fnRender to add some html to some columns, but when I needed to use the original data in javascript afterwards, I noticed that it was not possible using fnGetData since it is affected by fnRender. I think this should be changed so fnRender doesn't affect fnGetData or for preserving backwards compatibility we would need a new function for example fnGetRawData.
If this is the intended behaviour, the documentation and naming of these methods and callbacks could be better.
For now I found out a workaround I can use. Instead of using fnRender, I use fnRowCallback to modify each row. This way fnGetData will still return the raw data.
This discussion has been closed.
Replies
Ultimately I want fnRender to "go away", although that won't happen any time soon since a lot of applications depend upon it, but ultimately it should be replaced with mDataProp given as a function. With mDataProp as a function you have the ability to use orthogonal data for display, sorting, filtering and type detection (i.e. different data can be used for each). So its a lot like fnRender, but so much more capable. I'd such having a bash at that if bUseRendered doesn't do enough for you. There is an example of this use of mDataProp in the docs: http://datatables.net/docs/DataTables/1.9.0/DataTable.defaults.columns.html#mDataProp .
I do intend to write a blog post describing this orthogonal data use in detail soon :-)
Allan