[CLOSED] ImageCommandColumn command handler

  1. #1

    [CLOSED] ImageCommandColumn command handler

    Is it possible to get a reference to the actual imagecommand object during the command listener? Currently, the listener has the following parameters

    
    item,command,record,recordIndex,cellIndex
    item is actually the imagecommandcolumn, and not the actual imagecommand. command is just text. During the prepareCommand handler, I add some custom properties to the command object. I would like to retrieve those during the command event.
    Last edited by Baidaly; Jan 11, 2013 at 7:47 PM. Reason: [CLOSED]
  2. #2
    Hello!

    Try to use in the handler following code to get command:

    item.commands.filter(function(c) { if (c.command == command) return c; })[0]
  3. #3
    Quote Originally Posted by Baidaly View Post
    Hello!

    Try to use in the handler following code to get command:

    item.commands.filter(function(c) { if (c.command == command) return c; })[0]
    item.commands only contain the initial config and not any modifications i made during the prepareCommands handler.
  4. #4
    Hi,

    image command object doesn't saved anywhere, it is just passed to template during rendering
    I suggest to save required information inside record object
  5. #5
    Quote Originally Posted by Vladimir View Post
    Hi,

    image command object doesn't saved anywhere, it is just passed to template during rendering
    I suggest to save required information inside record object
    So if I have multiple commands, I need to store all the commands on the record object and then on command event, loop through those, and match by command text to find the command?
  6. #6
    Well, loop is not required, you can save command info in prepareCommand
    record.commands = record.commands || {};
    record.commands[commandName] = {.....};
    In Command listener
    var obj = record.commands[commandName] || {};
  7. #7
    I will give that a try.

    What about the event argument? Anyway to get "e" from the command event? I am manually creating a menu and want to show it next to the imagecommand (trying to hack my own version of command with a dropdown menu without using the slower CommandColumn)
  8. #8
    Looks like I can just do Ext.EventObject to get the current "e" event object. Thanks!

Similar Threads

  1. [CLOSED] ImageCommandColumn
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 15, 2012, 7:44 PM
  2. how to make Command Handler ViewStateEnabled
    By harshad.jadhav in forum 1.x Help
    Replies: 3
    Last Post: Dec 02, 2010, 7:47 AM
  3. ImageCommandColumn
    By gisxiaowei in forum 1.x Help
    Replies: 3
    Last Post: Aug 26, 2009, 4:46 PM
  4. [CLOSED] ImageCommandColumn bug
    By alexp in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 03, 2009, 11:15 AM

Posting Permissions