[CLOSED] Knowing the Grid who's sending the Record

  1. #1

    [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...

                '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]
  2. #2
    Hi Peter,

    Please use:
    editColumn.Listeners.Command.Handler = "handleItem(command, record, this.grid);"
    function handleItem(command, record, grid)
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi Peter,

    Please use:
    editColumn.Listeners.Command.Handler = "handleItem(command, record, this.grid);"
    function handleItem(command, record, grid)
    LOL - Life can be so easy :-)

Similar Threads

  1. DropdownField value is not sending
    By inf2k in forum 2.x Help
    Replies: 2
    Last Post: Apr 06, 2014, 2:21 PM
  2. Replies: 1
    Last Post: Oct 01, 2012, 5:29 PM
  3. FileUploadField - sending attached error
    By fabiomarcos in forum 1.x Help
    Replies: 0
    Last Post: Apr 26, 2010, 5:51 PM
  4. Sending Store Data To Server
    By kumarxlnt in forum 1.x Help
    Replies: 0
    Last Post: Oct 27, 2009, 2:02 AM
  5. Replies: 5
    Last Post: Nov 14, 2008, 3:03 PM

Posting Permissions