Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird changes in server-side API #1869

Closed
wglas85 opened this issue Oct 10, 2019 · 1 comment
Closed

Weird changes in server-side API #1869

wglas85 opened this issue Oct 10, 2019 · 1 comment

Comments

@wglas85
Copy link
Contributor

wglas85 commented Oct 10, 2019

We are struggling to get deletion of record working with our JAVA backend and we observed, that the documented API in http://w2ui.com/web/docs/1.5/grid is no longer valis since the commit for issue #1353.
The API changed from

{
"cmd" : "delete-records",
"selected" : [1, 2]
}

to

{
"action" : "delete",
"recid" : [1, 2]
}

where 'recid' is now replaced by any custion recid property name like 'id' or 'itemId', if configured.
The change from 'cmd' to 'action' also applies to the 'save-records' vs. 'save' method.
Before the commit for #1353 we had a intermediate phase, where neither 'cmd' nor 'action' was posted to the server.
Moreover, I think the 'action' change break the code, because in lines 2504 and 2505 we find code like this:

if (params.cmd == 'save' && typeof edata.url == 'object') url = edata.url.save;
if (params.cmd == 'delete' && typeof edata.url == 'object') url = edata.url.remove;

This code will not work, because params.cmd is never set in the code above these lines.
So, please clean up the server-side interface and stick to one decision.
Best regards, Wolfgang

@vitmalina
Copy link
Owner

To clean up api and remove unused parameters, the cmd and selected were removed. As it does not make sense for grid data load calls. However, it does make sense for delete and save (inline editing). So, the parameter is present in those calls, but it was renamed as action and recid. The reason it is recid is because it will either send recid, or if you defined custom column as recid with grid.recid, it will send it.

Please note, you can use onLoad and onRequest event and overwrite default params and you can make it as send "cmd" if you need to. And since all this properties were moved to prototype. You can overwrite it for all grids with one definition w2obj.grid.onRequest = function ...

As for params.cmd issue you reported in the second part of the issue, I have fixed it and will push the commit in a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants