а

[solved] Button to alter value in column with column combo doesn't trigger save


#1

I want to use a ‘button’ to set the value of a combobox field to 0.
This button is present on every row in the grid because it is a column combobox (see xml).
The button is triggered through the “onRowSelect” event and inside the event checked using getColumnId().
Inside the event you enter a dhtmlx.confirm and if the user confirms, I wish to set the value/option of the combo at that row, to 0, and hopefully trigger the updated event to have the change saved.

I am able to change the value using grid.cells(‘1_20’,2).setValue(0);
But this doesn’t trigger the event that should save the new value.
My attempts to use other methods simply results in errors since they assume this cell is a combo which somehow it isn’t.
Examples I’ve found sofar haven’t targeted this scenario and I am hoping the community can shed some light on this.

Apologies for the xml spam and thanks in advance for any help.

The grid loads the following xml:
<rows>
<head>
<column id="project" type="ro" align="left" width="" sort="strci">Projectnumber</column>
<column id="template" type="ro" align="left" width="
" sort="strci">Template</column>
<column id="name" type="combo" align="left" width="*" sort="strci" xmlcontent="1" filter="true">Name
<option value="0">[none]</option>
<option value="1">apple</option>
<option value="2">melon</option>
<option value="3">orange</option>
<option value="4">lemon</option>
<option value="5">grape</option>
</column>
<column id="btndelete" type="ro" align="left" width="80" sort="strci"/>
<afterInit>
<call command="attachHeader">
<param>#select_filter_strict,#select_filter_strict,#select_filter_strict</param>
</call>
</afterInit>
</head>
<row id="1_20">
<cell>VALUE_001</cell>
<cell>Interesting value</cell>
<cell>1</cell>
<cell>delete</cell>
</row>
</rows>


#2

Finally found the reason why setValue() didn’t trigger a save.
In this case you have to set it yourself using:
dataprocessor.setUpdated(rId,true);

I saw a couple of posts about how to alter values WITHOUT triggering events so I assumed triggering events would not require any extra steps.


#3

You’re right.

In case of changing the cell value using the API (like the setValue method) you need to trigger the setUpdated() manually.
This is the designed behavior.