Decoupling data from display
Decoupling data from display
What is the best way to decouple data (from a Javascript array or an Ajax source) from the display? The reason is I often deal with arrays which contain more data than actual columns I want to display - often the table I display in the end has very little (structure wise) with the data I'm actually sending.
For example, a column which displays a link and a name of that link technically takes 2 variables from the data array, the URL and the name of that link you want to display. Or I might provide an unique ID number for the row for subsequent links (ie: Edit), along with other links like Delete, etc. Obviously in this scenario, the data I send over the wire has very little to do with how I display the table.
Right now I basically am forced to use the aoColumns object and constantly use fnRender to pull whatever data I need, though that aoColumns object has to equal the same length as my data source. Is there a better way to be doing all this?
For example, a column which displays a link and a name of that link technically takes 2 variables from the data array, the URL and the name of that link you want to display. Or I might provide an unique ID number for the row for subsequent links (ie: Edit), along with other links like Delete, etc. Obviously in this scenario, the data I send over the wire has very little to do with how I display the table.
Right now I basically am forced to use the aoColumns object and constantly use fnRender to pull whatever data I need, though that aoColumns object has to equal the same length as my data source. Is there a better way to be doing all this?
This discussion has been closed.
Replies
Allan