[CLOSED] Enable and Disable GridCommand from Click in Button

  1. #1

    [CLOSED] Enable and Disable GridCommand from Click in Button

    Hi, I have a issue with the GridCommand on the GridPanel

    I have a GridPanel, and I have one Column with 2 Command, but I need only work with one of those, for example, if I Press the first button(Disabled Comman1), this disable all first command, and if I press the second Button (Enabled Command 1), this will be enable only the first command too, do you can give me some suggestions? Thanks

    Click image for larger version. 

Name:	Captura.PNG 
Views:	1 
Size:	20.7 KB 
ID:	21781

    <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
                List<Pruebas> lPruebas = new List<Pruebas>();
                for (int i = 0; i < 5; i++)
                    Pruebas oPruebas = new Pruebas();
                    oPruebas.Column1 = "Columna1" + i;
                    oPruebas.Column2 = "Columna2" + i;
                sDefault.DataSource = lPruebas;
            public class Pruebas
                string column1;
                string column2;
                public string Column1 { set { column1 = value; } get { return column1; } }
                public string Column2 { set { column2 = value; } get { return column2; } }
            <ext:ResourceManager ID="rmDefault" runat="server" HideInDesign="true" />
                    <ext:Store ID="sDefault" runat="server">
                            <ext:Model ID="mDefault" runat="server">
                                    <ext:ModelField Name="Column1" Type="String" />
                                    <ext:ModelField Name="Column2" Type="String" />
                    <ext:Toolbar ID="tbDefault" runat="server">
                            <ext:Button ID="btnEnable" Text="Disable Command 1" runat="server">
                                    <Click Handler="" />
                            <ext:Button ID="btnDisable" Text="Enable Command 1" runat="server">
                                    <Click Handler="" />
                        <ext:Column ID="cColumna1" runat="server" DataIndex="Column1" Text="Column1" />
                        <ext:Column ID="cColumna2" runat="server" DataIndex="Column2" Text="Column2" />
                                <ext:GridCommand CommandName="Test1" Icon="Accept" />
                                <ext:GridCommand CommandName="Test2" Icon="Add" />
    Last edited by fabricio.murta; Feb 24, 2015 at 7:37 PM. Reason: [CLOSED]
  2. #2
    Hello @osef,

    I tried to find a way to selectively sweep the store disabling the buttons, but this seems not possible, or not trivial.

    But as for your main goal, I believe this is sufficient.

    Add this javascript to enable/disable the buttons:
                    function enableAllFirst() {
                        App.ccPrueba.commands[0].disabled = false;
                    function disableAllFirst() {
                        App.ccPrueba.commands[0].disabled = true;
    And then call them from the respective handlers you left empty on your code (lines 53 and 58).

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    thank you so much, it works fine for me

Similar Threads

  1. [CLOSED] Disable GridCommand of a gridPanel on Command Click
    By otouri in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 16, 2013, 1:43 PM
  2. [CLOSED] Enable/Disable Button
    By FVNoel in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 19, 2013, 12:02 PM
  3. Replies: 1
    Last Post: Jul 28, 2011, 4:25 PM
  4. Button Enable/Disable
    By Maia in forum 1.x Help
    Replies: 5
    Last Post: Jul 02, 2010, 8:03 PM
  5. [CLOSED] disable/enable gridcommand
    By idrissb in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 03, 2009, 2:25 PM

Tags for this Thread

Posting Permissions