Mar 19, 2013, 11:12 AM
[CLOSED] Knowing the Grid who's sending the Record
Hi all
I try to write a generic method to add column editors to our grid's.
It not a big thing to do that...
The JS function looks like this :
Peter
I try to write a generic method to add column editors to our grid's.
It not a big thing to do that...
'Edit Column
Dim editColumn As New CommandColumn
editColumn.ID = grid.ID & "colEdit"
editColumn.Width = New Unit(120)
If columns.Contains(EditColumns.Edit) Then
Dim editCommand As New GridCommand
editCommand.CommandName = "cmdEdit"
editCommand.Icon = Icon.Pencil
editColumn.Commands.Add(editCommand)
End If
If columns.Contains(EditColumns.Delete) Then
Dim delCommand As New GridCommand
delCommand.CommandName = "cmdDelete"
delCommand.Icon = Icon.Delete
editColumn.Commands.Add(delCommand)
End If
editColumn.Listeners.Command.Handler = "handleItem(command, record);"
'Add the Edit Column as 2nd Col after the hidden Id Col
grid.ColumnModel.Columns.Insert(1, editColumn)
The only problem i face now, is to know which grid sends the record. I've got 9 grid on the view and each one has this edit columns added with the code above.The JS function looks like this :
function handleItem(command, record) {
switch (command) {
case 'cmdAdd':
addItem(command, record);
break;
case 'cmdDelete':
deleteItem(command, record);
break;
case 'cmdEdit':
editItem(command, record);
break;
default:
}
};
Is there a way to resolve the grid that sends the command ?Peter
Last edited by Daniil; Mar 19, 2013 at 12:01 PM.
Reason: [CLOSED]