Hi,
I have a datastore connected to a custom server-side.
When i try to delete a record by:
store.remove(selectedItem);
dp.sendData();
the record is deleted from the store in advance, even if the server-side returns something like:
Hi,
I have a datastore connected to a custom server-side.
When i try to delete a record by:
store.remove(selectedItem);
dp.sendData();
the record is deleted from the store in advance, even if the server-side returns something like:
Can anybody tell me if the datastore with a grid and form connected to it is the right approach, or should i stick to loading data directly into the grid and make most of the columns hidden.
It is expected result. As visual marking will not propogate from datastore to the linked components, it will delete records without awaiting the server side confirmation.
As for second question, if you have a lot of column which are visible in form, but doesn’t exist in the grid - it has sense to create a datastore and link both grid and form to it.
Hi Stanislav,
Thanks for the answers.
Could you advice me on how to resolve this issue:
I have a grid with a form connected.
The data is edited in the form and on form submit the dataprocessor will send the data to the server-side. On the server side i have extra data validation that will return a error if needed, and the client i will show this error, and return the grid status to updated = false.
All of this works correct, but now my problem.
If the server-side has returned an error and the user selects another row in the grid, the data will be out of sinc, so if the update to the server fails it will update the grid, even if the back-end returned an error.
I understand that this is expected behavior, but could you please give me some input on how to solve this. Is it possible to bypass the grid, and submit the formdata directly through the dataprocessor, and if this results correct, update the grid.
Or should i try to backup the grid-row data and restore the old values if the server-side returns an error.
Thanks…
I understand that this is expected behavior, but could you please give me some input on how to solve this. Is it possible to bypass the grid, and submit the formdata directly through the dataprocessor, and if this results correct, update the grid.
You can
While all above is possible, it will require a relative big ammount of code. It may have sense to use differnet approach - for example you can mark row in grid, after “error” response. So it will be clearly visible that row contains wrong data. Or you can call grid.updateFromXML against the target row, to reload it with valid values from the server side.
grid.updateFromXML works for me.
But is there a similar methode on the datastore?
Yes, you can use
store.load("data.php")
Same as for data loading. If data contains records with already existing id - such records will be updated ( so there is no need for separate updateFromXML command )