prevent Editor to get new list
prevent Editor to get new list
ansarigmbh
Posts: 24Questions: 7Answers: 0
in Editor
How can I prevent Editor to get the new list from server while editing a cell or row in the server side mode? Is an option for doing this or I have to edit base code!?
This discussion has been closed.
Answers
I think we'll need a little more information please - can you show us an example? Editor itself will not get a new list from the server when editing a select list.
Allan
I've written an example. please help me...
I'm afraid I'm still not clear what the problem is - could you detail it a little bit more please? My understanding thus far is then every time you open an Editor edit view, it makes a request to the server to get new data for a select list, and you don't want it to do that. Is that correct?
Editor should not be doing that if it is, and I don't see anything in the above code that would cause it to do that.
Allan
Hi. Thanks for replying.
Actually I opened an Editor and wrote my new values in fields and submitted the form. when Editor sends data to the server with Ajax, I don't know why DataTables get new list of current page from the server. It's like that editor redraw table after editing.
It does.
DataTables must do a draw after an edit to correctly filter and sort the data in the table, which might have been modified after the edit. Since you have server-side processing enabled (
serverSide: true,
) the data is at the server and thus an Ajax request is required.There is no option to disable that other than to modify the Editor source, as it is designed to operate this way.
Allan
Your reason might be true. but in my case I have lots of problem with redrawing.
for example
1- I can not tab between columns for editing.
2- Two AJAX call for every editing that can make my server App busy but One AJAX request is enough for editing data.
3- Missing editing row because of going the editing row to another page when sorting is enable.
please help me to disable this feature in source code!
The tab example should work with server-side processing enabled when using Editor 1.3.3.
Yes, unfortunately the Editor payload cannot currently contain the DataTables payload as well. So it needs one Ajax request for the edit and then another for the DataTables draw. That is an unfortunate side effect of using server-side processing.
The edited row moves page due to the sort? That would happen on client-side processing as well if the row has to move sort position.
Search for
if ( __dtIsSsp( dt ) ) {
in the code. In thecreate
andedit
handlers, just comment out the call to thedraw()
method. That will stop it doing a redraw and won't show the latest data from the server (which the draw is needed for).Allan
Thanks for replying :-)
yes but because of redrawing the "cell" doesn’t exist after drawing:
No. Edited row will go to other pages. current page will not change.
Thanks for helping about source. I commented out the call to the draw() and it was edited correctly but the value of the cell didn't change to the new value in client :-(
That is correct - that is what the draw does in server-side processing mode. It requests the new data from the server. If you want refresh data in server-side processing mode, the Ajax request is not optional.
Allan
Where is the source code in the JS file? I cannot seem to find it when doing a search in editor.min.js?
EDIT: Nevermind. Can't edit the trial version. Downloaded and purchased 1 developer license only to see that even removing the code does not fulfill the need.
There really needs to be an override option, so that upon edit, it does a draw just based on the current view represented (as if it was client side for that single instance); understanding that the data will not be resorted, refiltered, etc (until filter/sort is clicked or the page is refreshed, and therefore reapplied). I recognize this would cause a break in seeing if the data had been updated elsewhere, but you're already going to have that if multiple users are working the same data anyways.
Otherwise, with respect and apologies, the server-side processing + inline functionality is simply unusable.
Hi,
When using server-side processing every draw of the data must make a call to the server to get the data. This is because the server is the one which will sort and filter the data - so if the edit means that the row moves in the current sort - then it is only the server that can do that, since the fully data set is there and not at the client-side.
The change that I think should be made is that Editor's Ajax return from the edit request should include the server-side processing data for the next draw - meaning that there is only one Ajax request rather than two.
Allan
I am not sure if the coding on this topic has changed, but the answer seems contrary to the example page given here: https://editor.datatables.net/examples/inline-editing/simple.html
There is 1 call the server, not 2. In the above example it POSTs the data and gets a response, updates the field and you can continue. But that is not what it is doing when I try the code. It POSTs and then GETs the table again. And when it does that, the ...Processing... bar never leaves and I get a "too much recursion" error in the console.
There's 1 because server side is
false
Can you link to a page that shows the problem please.
Allan
Oyawebos