PDA

View Full Version : Setting GridCommand name upon rendering according to store data



eitanby
Jun 15, 2017, 10:24 AM
Hi,

I am using GridCommand on my grid to create command button named Activate:


<ext:CommandColumn ID="CommandColumn" Text="Action" runat="server" Width="160">
<Commands>
<ext:GridCommand CommandName="Activate" Text="Activate"/>
</Commands>
<Listeners>
<Command Handler="HandleCommand(command, record);" />
</Listeners>
</ext:CommandColumn>


What i need to achieve is the ability to change the command text according to the match row data in the Store
of this grid (so sometimes it will be named Activate and sometimes Deactivate)
Also i need to be able to identify which state the command is in order to handle it diffrently when pressed.

fabricio.murta
Jun 15, 2017, 9:03 PM
Hello @eitanby!

Please check this example, I'm confident it highlights exactly the feature you want to explore!
- GridPanel - Commands - Prepare commands (http://examples4.ext.net/#/GridPanel/Commands/Prepare_Commands/)

Well, and while you are at it, take your time to browse the examples. There are a lot but I'm sure if you give them a quick look, the next time you need something you'll remember you have seen that in the examples and then you could save yourself a lot of trouble guessing how to do something with Ext.NET! :)

Hope this helps!