Using fnUpdate in combination with fnRender
Using fnUpdate in combination with fnRender
morthahna
Posts: 18Questions: 0Answers: 0
Hi there,
i preformat some of my visible columns to also show data from hidden ones. I'm actually aggregating data of multiple fields into one. This works just fine for normal rendering, but not when I'm altering a row, regardless of replacing the whole row or just one explict column. When I update hidden columns, the new data is not beeing processed in the visble column referring to it in the fnRender call via oObj.aData[6] for example. When i refer to visible colums, it works just fine.
Is this a bug or a normal behaviour? How to work around?
Cheerio,
Sascha
i preformat some of my visible columns to also show data from hidden ones. I'm actually aggregating data of multiple fields into one. This works just fine for normal rendering, but not when I'm altering a row, regardless of replacing the whole row or just one explict column. When I update hidden columns, the new data is not beeing processed in the visble column referring to it in the fnRender call via oObj.aData[6] for example. When i refer to visible colums, it works just fine.
Is this a bug or a normal behaviour? How to work around?
Cheerio,
Sascha
This discussion has been closed.
Replies
> When I update hidden columns, the new data is not beeing processed in the visble column referring to it in the fnRender call via oObj.aData[6] for example
If I understand correctly, you have a visible column with fnRender on it, and that fnRender function refers to a data in a hidden column - is that correct? fnRender is only called once on a table cell - unless explicitly told otherwise (this is to save rendering the same thing multiple times), as such, the visible information won't be updated, as you are seeing, since it have already been rendered.
What you can do is call fnUpdate() first on the hidden cell, and then on the visible cell. I fully accept that this is not exactly ideal(!) and it might be an idea in future for DataTables to allow arrays to be passed into the fnUpdate parameter - I've noted this down on my possible future enhancements list. But it is the expected behaviour at the moment - an optimisation which will require an extra step to work with.
Regards,
Allan