0
votes

I am using RowEditor plugin for my grid. Grid record has three buttons: choose,update,cancel. When I click on choose it will display another grid and user has to click on one record, then some values of that record have to display on the previous grid. How to do this ? I am using extjs 3.0

Thanks in advance!

3

3 Answers

0
votes

When you click on choose - show a modal window popup with grid. When you open that popup pass a callback into constructor of the popup. Then force user to select only one record in grid (using rowselectmodel). On itemclick even of the child grid - call your callback and pass selected data in the parent grid. Update parent's grid record with this data.

Hope I was clear.

0
votes

To figure out which row the user selected, use the Ext.grid.GridPanel's SelectionModel. The default model is Ext.grid.RowSelectionModel (use selModel config setting to change the default). To grab the selected row, call myGridPanel.getSelectionModel().getSelected(). That will return an Ext.data.Record. Dig into that data to populate the original grid/store.

0
votes

Thanks for your reply. I have done the required things. How I have done is, just passed the editor to my function and using selection model, I got the values and have placed them into the editor.

val1 = selectedArray[0].get('val1');
var cm = grid.colModel, fields = editor.items.items, f, val;
f = fields[1];
f.setValue(val1);
editor.values[f.id] = val;

This makes my life easier.

But, I have another problem, after placing into the editor. I have to do validation in the afteredit event, if user clicks the update button. In the afteredit event,

afteredit: function(object, changes, record, rowIndex)
{
    // I have to do validation on the changes; but its an object. How will I do it 
    ???
}