GridPanel - control visibility of column by using another dataindex's value

  1. #1

    GridPanel - control visibility of column by using another dataindex's value




    How do I set the visible property of the column "Quantity" by using the value from another column from the same store.

    DataIndex="bitDiscontinued" within a girdpanel.

    
    
    
    <ext:NumberField ID="txtQuantity" MaxValue="2000" AllowNegative="false" AllowDecimals="false"
    
    
    MaxLength="4" 
    
    
    <U>Visible="Want to use the DataIndex="bitDiscontinued" to control the hiding of this column"</U> 
    
    
    runat="server" />


    
    
    <ext:GridPanel runat="server" ID="GridPanel1" Height="400px" ClicksToEdit="0" Frame="true"
    
    
    Border="true" StoreID="Products">
    
    
    <ColumnModel ID="ColumnModel1" runat="server">
    
    
    <Columns>
    
    
    <ext:Column Header="ProductVersionId" DataIndex="atnProductVersionId" Sortable="true"
    
    
    Hidden="true">
    
    
    <Editor>
    
    
    <ext:TextField ID="TextField12" runat="server" />
    
    
    </Editor>
    
    
    </ext:Column>
    
    
    <ext:Column Header="Number" DataIndex="strProductVersionNumber" Sortable="true">
    
    
    <Commands>
    
    
    <ext:ImageCommand CommandName="Details" Icon="Information" Style="margin-left: 5px !important;" />
    
    
    </Commands>
    
    
    </ext:Column>
    
    
    <ext:Column Header="Quantity" DataIndex="numQuantity">
    
    
    <Editor>
    
    
    <ext:NumberField ID="txtQuantity" MaxValue="2000" AllowNegative="false" AllowDecimals="false"
    
    
    MaxLength="4" 
    
    
    <U>Visible="Want to use the DataIndex of bitDiscontinued - How do I do this"</U>
    
    
    runat="server" />
    
    
    </Editor>
    
    
    </ext:Column>
  2. #2

    RE: GridPanel - control visibility of column by using another dataindex's value

    Hi,

    If you want to prevent the editing of particular cell then use BeforeEdit listener

    <BeforeEdit Handler="if(e.field == 'Quantity'){e.cancel = e.record.bitDiscontinued;}"/>
  3. #3

    RE: GridPanel - control visibility of column by using another dataindex's value

    Thanks that solved the issue but ended up doing something like this to keep a quantity from being entered in.
    
    
    
    <Listeners> 
    
    
    <BeforeEdit Handler="#{txtQuantity}.setDisabled(!e.record.data.bitHideBackProductVersion); " /> 
    
    
    </Listeners>

Similar Threads

  1. GridPanel visibility
    By AlexMaslakov in forum 1.x Help
    Replies: 5
    Last Post: Aug 17, 2011, 12:56 PM
  2. Replies: 2
    Last Post: Jul 20, 2011, 6:03 AM
  3. Replies: 4
    Last Post: Apr 03, 2011, 8:21 AM
  4. Replies: 16
    Last Post: Sep 07, 2010, 6:31 PM
  5. [CLOSED] Setting GridPanel column dataindex
    By tansu in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 20, 2009, 3:42 PM

Posting Permissions