Processing indicator with stateRestore
Processing indicator with stateRestore
trongart
Posts: 222Questions: 51Answers: 0
in StateRestore
It it possible to show the processing indicator when a state is loaded from stateRestore?
I added processing : true
and table.processing(true);
with setTimeout
into stateLoadParams
, but this does not seem to work. Is there a different place where I need to add the processing code?
Test case: live.datatables.net/pivofaco/1/edit
Answers
processing()
is a plugin, so you'll need to include that in your code, something like this: http://live.datatables.net/bezonefo/1/editColin
@colin Included the processing library in this updated test case: live.datatables.net/zopihoki/1/edit
Not sure how to make the processing indicator appear when stateRestore is loaded. I added the processing code into
stateLoadParams
.You're using
table
instateLoadParams
, buttable
has been created at that point, using the settings to get an API handle:See here,
Colin
@colin Thank you very much- this makes sense.
It starts the processing indicator only after a state is loaded and not after the button to load a state is clicked (such as State 1). It's too quickly to notice in the test case, but this happens in larger tables. Is it possible to make the processing indicator run once a button within stateRestore is clicked?
The processing indicator also no longer runs when the table is loaded for the first time until it stops loading (verified in my project).
In the test case, if you choose 6+ items with the searchBuilder, save the search with stateRestore, then reload the page and load the "test state" from stateRestore, it is possible to see that the processing indicator only appears after all results are loaded instead of when the "test state" button is clicked.
@colin Is there maybe a way to call the processing indicator specifically any time the
stateRestore.state().load() API is used?
My thinking is that in this case, the processing indicator will show once a stateRestore state button is clicked to load, but not sure if it is possible to do it this way.
No, there isn't a callback for you to do that. You may be able to create a click event on the button, but not sure what the selector would be for that,
Colin
Would it work by using a custom button as I could do something as below:
That might work, give it a try!
Colin
Just not sure how to call savedStatesCreate in a custom button such as:
$.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, node, config);
Is there a way?
@trongart Did you every solve this? I am having the same issue. When stateRestore state is selected the stateRestore menu remains displayed for over 6 seconds before dropping when I have 8000 rows of data.