Need help: Using DirectMethod to set hidden property for ImageCommand

  1. #1

    Need help: Using DirectMethod to set hidden property for ImageCommand

    I have a grid with a few columns. One of these columns has two ImageCommand "Pass" and "Fail" respectively. I want both of these commands be either hidden (disabled if possible) if a certain criteria is met.

    <ext:Column runat="server" Text="Result" DataIndex="Result" Flex="1" MinWidth="180">                            
            <ext:ImageCommand CommandName ="Pass" Icon="Accept" Text="Pass" >
                <ToolTip Text="Pass" />                                    
            <ext:ImageCommand CommandName="Fail" Icon="BulletCross" Text="Fail">
                <ToolTip Text="Fail" />
        <PrepareCommand Handler=";"/>
            <Command OnEvent="TestReportStepResult_Click">
                <EventMask ShowMask="true" />
                    <ext:Parameter Name="Id" Value="" Mode="Raw" />
                    <ext:Parameter Name="Command" Value="command" Mode="Raw" />
    The DirectMethod returns a boolean value. However, regardless of whether the DirectMethod returns true or false, the commands are always hidden.

    NOTE: If the prepare command is written like this: "command.hidden=false;" the ImageCommands shows up. If its true it doesn't show up which leads me to understand that the issue is in the DirectMethod. Of course, I have already made sure that the method is getting called and executed correctly by using a breakpoint.

    I am searching for a way to make my commands hidden depending on a property (which can only be calculated trough the code behind).
    Thanks in advance for anyone who might try to solve this issue with me.
  2. #2
    I haven't run any tests to confirm this, but can you try calling either the .setHidden() or .setVisible() function instead of setting .hidden property. For example:

    // or, 
    Another option to try would be .hide() or .show().

    We'll investigate the source and figure out what's possible.
    Geoffrey McGill
  3. #3
    Unfortunately these 4 alternatives didn't work. It made it worse, the columns that were set after the "Result" column didn't even load.
  4. #4
    I have found a workaround for this issue. I added a hidden TextField which would be initialized in the code behind as 'true' or 'false' depending of my parameters. Then, the prepare command would look like this:

    <PrepareCommand Handler="if(#{TextValidatedOrClosed}.value=='true') command.disabled=true; else command.disabled=false;"/>
    TextValidatedOrClosed refers to the ID of the hidden TextField.

    This works for my issue. We can close this thread.

Similar Threads

  1. Replies: 2
    Last Post: Feb 02, 2015, 9:58 AM
  2. Replies: 1
    Last Post: Nov 05, 2013, 3:15 AM
  3. Replies: 2
    Last Post: Mar 09, 2013, 6:05 AM
  4. Replies: 6
    Last Post: Mar 09, 2013, 5:58 AM
  5. Set Icon ImageCommand
    By Maia in forum 1.x Help
    Replies: 1
    Last Post: Sep 06, 2010, 3:03 PM

Tags for this Thread

Posting Permissions