SmartCLient v 91p
Hi, i have a problem updating a hidden field of a listGrid.
Client side: I have a list grid and some Button code:
My DS code is like:
Supposing the user double clicks a listgrid record and edits some values, (e.g. field1) then, by means
of another visual object he modifies the hidden field of the listgrid (field3); the hidden field is modified
via a call to: gridName.setEditValue(rowNum, "field3", "newValue").
When gridName.saveAllEdits() is called I expected that the DMI update method was invoked with a DSResquest containing
the ID of the modified listgrid record and all modified fields, including the hidden record field.
Instead, the following happens:
On the client side, just before gridName.saveAllEdits() is called, all fields (both visible and hidden) of the modified record have all the new values.
When saveAllEdits()is called, on the server side the DMI 'update' method is called first with, in the DSRequest, the values of fields 'id' and 'field1'
but not the hidden field 'field3'.
Then, the DMI 'add' method is also automatically called, with the DSRequest containing only the hidden field 'field3'.
If the user only modifies the listGrid hidden field ( gridName.setEditValue(rowNum, "field3", "newValue") ),
gridName.saveAllEdits() only calls the DMI 'add' method, as describe above.
Hence, manually acting on a visible field triggers the 'update' method to be called, whilst programmatically changing a hidden field value results
in a call to the 'add' method'.
Is this the expected behavior ? Shouldn't the 'update' method be called instead, with both visible and hidden fields all together ?
Hi, i have a problem updating a hidden field of a listGrid.
Client side: I have a list grid and some Button code:
Code:
isc.ListGrid.create({
ID: "gridName",
dataSource: GridDS,
autoDraw: false,
canEdit: true,
autoSaveEdits: false,
autoFitWidth: true,
autoFitWidthApproach: "both",
showResizeBar: true,
fields: [
{name: "field1", canEdit: false, type: "text"},
{name: "field2", canEdit: true, type: "text"}
]
});
isc.Button.create({
ID: "saveBtn",
click: function () {
gridName.saveAllEdits();
}
})
isc.Button.create({
ID: "newBtn",
click: function () {
MPgrid.startEditingNew();
}
})
My DS code is like:
Code:
<DataSource ID="GridDS" serverType="generic">
<fields>
<field name="id" hidden="true" primaryKey="true" canEdit="false" required="false" type="float"></field>
<field name="field1" canEdit="true" required="false" type="text"></field>
<field name="field2" length="255" canEdit="true" required="false" type="text"></field>
<field name="field3" canEdit="true" required="false" type="hidden"></field>
</fields>
Supposing the user double clicks a listgrid record and edits some values, (e.g. field1) then, by means
of another visual object he modifies the hidden field of the listgrid (field3); the hidden field is modified
via a call to: gridName.setEditValue(rowNum, "field3", "newValue").
When gridName.saveAllEdits() is called I expected that the DMI update method was invoked with a DSResquest containing
the ID of the modified listgrid record and all modified fields, including the hidden record field.
Instead, the following happens:
On the client side, just before gridName.saveAllEdits() is called, all fields (both visible and hidden) of the modified record have all the new values.
When saveAllEdits()is called, on the server side the DMI 'update' method is called first with, in the DSRequest, the values of fields 'id' and 'field1'
but not the hidden field 'field3'.
Then, the DMI 'add' method is also automatically called, with the DSRequest containing only the hidden field 'field3'.
If the user only modifies the listGrid hidden field ( gridName.setEditValue(rowNum, "field3", "newValue") ),
gridName.saveAllEdits() only calls the DMI 'add' method, as describe above.
Hence, manually acting on a visible field triggers the 'update' method to be called, whilst programmatically changing a hidden field value results
in a call to the 'add' method'.
Is this the expected behavior ? Shouldn't the 'update' method be called instead, with both visible and hidden fields all together ?