Add additional parameter to Grid.Command event

  1. #1

    Add additional parameter to Grid.Command event

    Currently, the Grid.Command event exposes the command, record, and rowIndex. Is it possible to add an additional parameter for the actual item (menu, button, etc) clicked? For example, on an item click, I want to change the grid command icon.

    Here's a sample use case:
    1. Each grid row shows a project (name, description, status).
    2. Status is a CommandColumn with a menu. The menu items are Mark Approved, Mark Complete, etc.
    3. On menu item click, I want to change the icon of the grid command to reflect the new status.


    If the Command event exposes the button clicked, I can get the iconCls of the button and set its' parent's parent's icon to it.
  2. #2

    RE: Add additional parameter to Grid.Command event

    It would be great if it can pass the toolbar object too =P
  3. #3

    RE: Add additional parameter to Grid.Command event

    Hi,

    I don't think that it is a good idea because after each sorting/cell editing/data rebinding the row (or grid) will be refreshed (it is mean rerendering). Toolbar which used in CommandColumn will be recreated. In this case you will loose all changes that were made outise 'prepare' function.


    I recomend apply all changes in 'prepare' functions. When you need to update commands UI for particular row then call the following code


    grid.view.refreshRow(record);
    or
    grid.view.refreshRow(grid.store.getAt(rowIndex));
  4. #4

    RE: Add additional parameter to Grid.Command event

    Thanks for the suggestion. The grid refresh row worked for me.

Similar Threads

  1. Replies: 0
    Last Post: May 12, 2012, 11:24 AM
  2. Row Command event in grid panel
    By Dorababu in forum 1.x Help
    Replies: 0
    Last Post: Mar 08, 2012, 10:41 AM
  3. Replies: 5
    Last Post: Jun 10, 2011, 6:35 PM
  4. [CLOSED] Direct event parameter html value problem
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Jan 05, 2011, 4:30 PM
  5. Two Grids - submit additional parameter [0.82]
    By roszman in forum 1.x Help
    Replies: 2
    Last Post: Jun 24, 2010, 7:11 AM

Posting Permissions