Using datatables with SignalR
Using datatables with SignalR
Hi,
I have quite an interesting use case for datatables. I can get it 95% working, but no matter what I try, my workarounds always seem to have an unwanted sideeffect.
Background:
The application is a full screen datatable which receives new rows from SignalR (no page reload). My datatable has the following settings:
bProcessing: true
bServerSide: true
fnServerData: fnDataTablesPipeline (from the pipelining example)
...other settings are not too important...
The issue:
Although I am using the datatable in ServerSide mode I want to be able to add rows clientside. I have this working perfectly, I can add rows directly into the DOM and this works well. The problem is that when I do this I am unable to use the fnOpen and fnClose functions to open and close a details row as this seems to rely on some internal calls to the data structure. I also had problems using the hidden columns and using fnGetData with this method.
I then tried manipulating the fnDataTablesPipeline function to include the new data as and when a new SignalR row comes in, and then calling fnReDraw to redraw the grid, based on the new data. The problem is that I am getting probably 1 request per second coming in and the performance implications of calling ReDraw are too high. Other issues are that if you try and navigate to a new page and call redraw, the paging etc all gets resets.
I am struggling to work out a perfect solution for my scenario and was wondering if anyone has any ideas.
What I would really like is an fnAddData method that works for serverside too. I would be happy to put some effort into writing such a method if some people could point me in the right direction.
thanks,
Greg
I have quite an interesting use case for datatables. I can get it 95% working, but no matter what I try, my workarounds always seem to have an unwanted sideeffect.
Background:
The application is a full screen datatable which receives new rows from SignalR (no page reload). My datatable has the following settings:
bProcessing: true
bServerSide: true
fnServerData: fnDataTablesPipeline (from the pipelining example)
...other settings are not too important...
The issue:
Although I am using the datatable in ServerSide mode I want to be able to add rows clientside. I have this working perfectly, I can add rows directly into the DOM and this works well. The problem is that when I do this I am unable to use the fnOpen and fnClose functions to open and close a details row as this seems to rely on some internal calls to the data structure. I also had problems using the hidden columns and using fnGetData with this method.
I then tried manipulating the fnDataTablesPipeline function to include the new data as and when a new SignalR row comes in, and then calling fnReDraw to redraw the grid, based on the new data. The problem is that I am getting probably 1 request per second coming in and the performance implications of calling ReDraw are too high. Other issues are that if you try and navigate to a new page and call redraw, the paging etc all gets resets.
I am struggling to work out a perfect solution for my scenario and was wondering if anyone has any ideas.
What I would really like is an fnAddData method that works for serverside too. I would be happy to put some effort into writing such a method if some people could point me in the right direction.
thanks,
Greg
This discussion has been closed.