Change CELLINDEX to column id

I have a grid within a form, and submitting the data (only changed) is fine, but the data is in the format mygrid_container_ROWID_COLNUMBER.

I added ID’s to the columns in the XML feed and I can then refer to cells using var field_name = mygrid.getColumnId(col_ID); so I can tell which column is which. ie if(field_name==‘dob’) { // do something }, which is more readable than if(col_ID==8). And if the order of the data changes for some reason, I dont have to change all the javascript.

Is there any way to attach this field name to the cell when submitting the data, so I know which column refers to which field in the database. At the moment I have to use a list of fields so i can convert them back and hope I dont forget to change both data-source and data-save when making alterations.

I have tried using mygrid.enableCellIds(true); before loadXML, after loadXML, in beforeInit and in afterInit, but it doesn’t seem to change anything.

Cheers in advance

mygrid = new dhtmlXGridObject(‘mygrid_container’);

User #cspan #cspan Personal Details #cspan #cspan #cspan #cspan true First Name,Surname,Username,Tel,Mobile,Address,Postcode,DoB px bob hoskins sdkfjsdfh 111111 55555

Wouldn’t you know it! after several hours testing and searching, I found the solution within minutes of asking for help. :blush:


which gives posted values of:-
:arrow_right: [mygrid_container] => Array
:arrow_right: (
:arrow_right: :arrow_right: [2345] => Array
:arrow_right: :arrow_right: (
:arrow_right: :arrow_right: :arrow_right: [wtel] => adfa
:arrow_right: :arrow_right: )
:arrow_right: )