how to accomodate two datatable in one page
how to accomodate two datatable in one page
espresso74
Posts: 11Questions: 0Answers: 0
hi,
I just put two datatables into my webpage, and ended up with error saying aoData is null. I wonder if it is possible to put two different datatables into one page. these two datatables have little bit different (columns, etc).
and i currently using datatable.pipeline, server side processing.
please advice.
thanks
dave
I just put two datatables into my webpage, and ended up with error saying aoData is null. I wonder if it is possible to put two different datatables into one page. these two datatables have little bit different (columns, etc).
and i currently using datatable.pipeline, server side processing.
please advice.
thanks
dave
This discussion has been closed.
Replies
Yes it's certainly possible ( http://datatables.net/examples/basic_init/multiple_tables.html ) - however I suspect the complication you are seeing here is due to the pipelining. You need to have separate instances of the pipeline processor, in order to have individual cache etc for each table. Easest way would be to duplicate and rename the function. However, there are better ways, which would allow truly unique instances to be created - it just wasn't written with that in mind originally.
Regards,
Allan
I will do a demo as for what u have suggest soon. and will let you know the results.
Thanks
Dave
yes, i duplicated the function, made the function name & Cache name different and it was working.
anyway, hopefully this pipeline functionality could be encapulated as Instance(as you said) in the future release.
again, thanks for your great products.
Cheers
Dave
[code]
var oCache = {
"table_id1":{"iCacheLower":-1},
"table_id2":{"iCacheLower":-1},
...
};
[/code]
Then I made the following change within the function:
[code]
function fnDataTablesPipeline(sSource,aoData,fnCallback) {
var sTableId = this.sTableId;
//anywhere oCache is called, I instead swapped in oCache[sTableId]
...
[/code]
Let me know what you think or if you see any issues with the idea. Obviously you'd have to individually ID tables but other than that, I believe this should work.
All the best,
Gary