PDA

View Full Version : [CLOSED] Command Column Disabled GridCommand in a Row



osef
Mar 10, 2015, 8:29 PM
Hi team I want to disabled a GridCommand in a specified row, but, with my example I get to disable all GridCommand Column, BY example I want to disable the row number 2 in the GridCommand "Test1".

http://forums.ext.net/attachment.php?attachmentid=22371&stc=1


http://forums.ext.net/attachment.php?attachmentid=22381&stc=1

All this with a Button "btnDisableRow"



<ext:ResourceManager ID="rmDefault" runat="server" HideInDesign="true" />

<ext:GridPanel
ID="gpDefault"
runat="server"
Height="200"
Width="303">
<Store>
<ext:Store ID="sDefault" runat="server">
<Model>
<ext:Model ID="mDefault" runat="server">
<Fields>
<ext:ModelField Name="Column1" Type="String" />
<ext:ModelField Name="Column2" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<TopBar>
<ext:Toolbar ID="tbDefault" runat="server">
<Items>
<ext:Button ID="btnEnable" Text="Disable Command 1" runat="server">
<Listeners>
<Click Handler="App.ccPrueba.commands[0].disabled = true; App.gpDefault.reconfigure();" />
</Listeners>
</ext:Button>
<ext:Button ID="btnDisable" Text="Enable Command 1" runat="server">
<Listeners>
<Click Handler="App.ccPrueba.commands[0].disabled = false; App.gpDefault.reconfigure();" />
</Listeners>
</ext:Button>
<ext:Button ID="btnDisableRow" Text="Disable Row 2" runat="server">
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<ColumnModel>
<Columns>
<ext:Column ID="cColumna1" runat="server" DataIndex="Column1" Text="Column1" />
<ext:Column ID="cColumna2" runat="server" DataIndex="Column2" Text="Column2" />
<ext:CommandColumn
ID="ccPrueba"
runat="server">
<Commands>
<ext:GridCommand CommandName="Test1" Icon="Accept" />
<ext:GridCommand CommandName="Test2" Icon="Add" />
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
</ext:GridPanel>

Daniil
Mar 11, 2015, 6:38 AM
Hi @osef,

Please have a look at this example.
http://examples2.ext.net/#/GridPanel/Commands/Prepare_Toolbar

osef
Mar 11, 2015, 4:32 PM
Hi Daniil, but I want after load records with a Button, I want to be fully manipulable both GridCommands in any row to disable and enable.

Thank you.

Daniil
Mar 11, 2015, 7:36 PM
You should still use a prepareToolbar. This Ext.NET v1 example demonstrates the idea.
http://forums.ext.net/showthread.php?12150&p=49623&viewfull=1#post49623

Instead of .refreshRow(record) you'll need to use .refreshNode(index).
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.locking.View-method-refreshNode