Edit grid records

Technologies > Software Engineering Techniques > Advanced Techniques > Edit Records Within the Grid

In this example, the user may click on a field in a grid and open a select value dialog to select a new value for the field. The editable field value is assigned a controlType of link and auto-wired to a JavaScript function:

<field name="rm_use" controlType="link" id="selectUse"/>


The JavaScript function opens a select value dialog and replaces the grid value with the selected value:

Ab.view.View.selectValue('', '', ['rm.rm_use'], 'rmuse', ['rmuse.rm_use'],
['rmuse.rm_use', 'rmuse.description'], null,

// specify callback function
function(fieldName, newValue, oldValue) {
controller.setRowValue(row, 'rm.rm_use', newValue, 4);
return false;
}
);


Note that the change has not yet been saved in the database. Call saveRecord to save the updated record:

var record = row.updatedRecord;
this.prgGridEditable_roomDs. saveRecord (record);

View: http://localhost:8080/archibus/schema/ab-products/solutions/programming/grid/ab-ex-prg-grid-editable.axvw