alxem
alxem

Reputation: 215

C# EXT: GridCommand: single click expands double click collapses RowExpander

I have a grid command "Edit" which expands a RowExpander with single click but you need to double click it to collapse it. Is it possible to collapse it with single click?

<ext:CommandColumn runat="server" Width="70">
       <Commands>
            <ext:GridCommand Icon="NoteEdit" CommandName="Edit">
                   <ToolTip Text="Edit" />
            </ext:GridCommand>
       </Commands>
       <Listeners>
            <Command Handler="if (command=='Edit') 
                   #{RowExpanderFormFields}.expandRow(recordIndex);" />
       </Listeners>
</ext:CommandColumn>

Upvotes: 1

Views: 85

Answers (1)

alxem
alxem

Reputation: 215

Added js check if rowexpander is expanded and if yes then collapse it.

<Command Handler="if (command=='Edit') 
{
         if(#{RowExpanderFormFields}.isExpanded(recordIndex))
                 #{RowExpanderFormFields}.collapseRow(recordIndex);
         else
                 #{RowExpanderFormFields}.expandRow(recordIndex);
}

Upvotes: 1

Related Questions