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

w2gid: custom recid field not recognized #1353

Closed
BBE78 opened this issue Oct 15, 2016 · 8 comments
Closed

w2gid: custom recid field not recognized #1353

BBE78 opened this issue Oct 15, 2016 · 8 comments

Comments

@BBE78
Copy link

BBE78 commented Oct 15, 2016

Hi,
On v1.4.3, the custom recid definition doesn't work properly:

grid: {
    ...
    recid: 'id'
    ...
}
@chalchis
Copy link

you can use the 'recid'
normally and using a hidden column as id

{ field: 'recid', caption: 'keygrid', size: '100px', hidden: true },
{ field: 'recid_custom', caption: 'key', size: '100px', hidden: true },

@BBE78
Copy link
Author

BBE78 commented Oct 15, 2016

This is not explained on your website, the only thing I'm using is described here: [http://w2ui.com/web/docs/w2grid.recid]
Does it impact the JSON format of the records? Because I can't...

@nexushoratio
Copy link
Contributor

It appears to work when the data is loaded AFTER object creation.

That is, use grid.load() or grid.add() to supply the data after setting everything else up.

@mrg2001
Copy link
Collaborator

mrg2001 commented Nov 3, 2016

@BBE78, I have just checked recid in 1.4.3 and it is working for me. If you specify it before load is triggered, then on load it will add recid to all records based on some other id. Please create jsFiddle where the problem is illustrated.

@quillaja
Copy link

in 1.5.rc1 setting the custom recid field allows the grid to read the id field of the data given to it, but does NOT use the custom recid when sending requests to the server. I would have expected the grid to use the custom recid in place of "recid" in all server requests to facilitate easier communication with the back end.

@vitmalina
Copy link
Owner

There are 3 types of calls that grid is doing. Get records - recid is not used in this call. Delete records, I have changed the code to submit custom recid and Save changes - I have changed the code to submit custom recid. Download latest code from /dist and you should be golden :)

@wglas85
Copy link
Contributor

wglas85 commented Oct 11, 2019

Thanks for the cleanup, please adapt the documentation likewise.
For the params.cmd issue, there are even more occurrences in lines w2uigrid.js:2545ff

         case 'RESTFULL':
              ajaxOptions.type = 'GET';
              if (params.cmd == 'save')   ajaxOptions.type = 'PUT';  // so far it is always update
              if (params.cmd == 'delete') ajaxOptions.type = 'DELETE';
              ajaxOptions.data = (typeof ajaxOptions.data == 'object' ? String($.param(ajaxOptions.data, false)).replace(/%5B/g, '[').replace(/%5D/g, ']') : ajaxOptions.data);
              break;
          case 'RESTFULLJSON':
              ajaxOptions.type = 'GET';
              if (params.cmd == 'save')   ajaxOptions.type = 'PUT';  // so far it is always update
              if (params.cmd == 'delete') ajaxOptions.type = 'DELETE';
              ajaxOptions.data        = JSON.stringify(ajaxOptions.data);
              ajaxOptions.contentType = 'application/json';
              break;

@wglas85
Copy link
Contributor

wglas85 commented Oct 11, 2019

Yet another review result: The code in w2grid.js is still POSTing 'cmd' instead of 'action' and uses 'recid' and not the configured recid property name.

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

7 participants