[CLOSED] [1.0] Gridview Editor Column handler

  1. #1

    [CLOSED] [1.0] Gridview Editor Column handler

    I have a Gridview built and I'm trying to find a way to set a checkbox to disabled depending on a handler. I'm using the plugin to allow me to edit the Gridview results, and the handler/fn does seem to execute however the checkbox I'm trying to update never shows, or works the way I'm expecting.

    I can create two checkbox controls just outside of the gridview and disable it using the same handler so I know it works. I just need to know if it's possible to do it on a gridview editor control field.

    Thanks!

    Here is a screenshot along with some code.

    <ext:GridPanel 
        ID="GridPanel1" 
        runat="server" 
        Frame="true"
        StoreID="Store1"
        StripeRows="true"
        Title="Inspection Entry"
        AutoExpandColumn="Question" 
        Collapsible="true"
        AnimCollapse="false"
        Icon="ApplicationViewColumns"
        TrackMouseOver="false"
        Width="900"
        Height="650"
        ClicksToEdit="1">
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:GroupingSummaryColumn 
                    ColumnID="Question" 
                    Header="Question" 
                    Sortable="true" 
                    DataIndex="Question" 
                    Hideable="false"
                    SummaryType="Count">
                    <SummaryRenderer Handler="return ((value === 0 || value > 1) ? '(' + value +' Questions)' : '(1 Question)');" />    
                </ext:GroupingSummaryColumn>
                                          
                <ext:Column ColumnID="Name" Header="Group Name" DataIndex="Name" Width="20" />
                
                <ext:CheckColumn DataIndex="Yes" Groupable="true" Header="Yes" Width="15">
                    <Editor>
                        <ext:Checkbox ID="GridEdit_Yes" runat="server" DataIndex="Yes" Width="15">
                        <Listeners>
                        <Check Handler="#{GridEdit_No}.disable();" />
                        </Listeners>
                        </ext:Checkbox>
                    </Editor>
                </ext:CheckColumn>
                 <ext:CheckColumn DataIndex="No" Groupable="true" Header="No" Width="15">
                    <Editor>
                        <ext:Checkbox ID="GridEdit_No" runat="server" DataIndex="No" Width="15">
                        </ext:Checkbox>
                    </Editor>
                </ext:CheckColumn>
                  <ext:CheckColumn DataIndex="NA" Groupable="true" Header="NA"  Width="15">
                    <Editor>
                        <ext:Checkbox ID="GridEdit_NA" runat="server" DataIndex="NA" Width="15">
                        </ext:Checkbox>
                    </Editor>
                  </ext:CheckColumn>
                  <ext:Column runat="server" ColumnID="text1" Header="Clarification of Deficiencies" DataIndex="Text1"><Editor><ext:TextArea runat="server" AnchorHorizontal="100%"></ext:TextArea></Editor></ext:Column>
                             <ext:Column runat="server" Header="Corrective Action Taken" ColumnID="text1" DataIndex="Text1"><Editor><ext:TextArea ID="TextArea2" runat="server" AnchorHorizontal="100%"></ext:TextArea></Editor></ext:Column>
            </Columns>
        </ColumnModel>
         <Plugins>
            <ext:EditableGrid ID="EditableGrid1" runat="server" />
        </Plugins>
        <View>
            <ext:GroupingView 
                ID="GroupingView1"  
                runat="server" 
                ForceFit="true"
                ShowGroupName="false"
                EnableNoGroups="true"
                HideGroupedColumn="true"
                />
        </View>            
        <Plugins>
            <ext:GroupingSummary ID="GroupingSummary1" runat="server" />
        </Plugins>           
    </ext:GridPanel>
  2. #2

    RE: [CLOSED] [1.0] Gridview Editor Column handler

    Hi,

    Please update from SVN.

    And try the following sample
    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.GridPanel1.Store.Primary.DataSource = new List<object>
                {
                    new { 
                        Enabled = true,
                        Value = 1, 
                        Text = "One"
                    },
                    new { 
                        Enabled = true,
                        Value = 2, 
                        Text = "Two"
                    },
                    new { 
                        Enabled = true,
                        Value = 3, 
                        Text = "Three"
                    },
                    new { 
                        Enabled = true,
                        Value = 4, 
                        Text = "Four"
                    },
                    new { 
                        Enabled = true,
                        Value = 5, 
                        Text = "Five"
                    }
                };
    
                this.GridPanel1.Store.Primary.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>GridPanel with EditableGrid Plugin - Ext.NET Examples</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <h1>GridPanel with EditableGrid Plugin</h1>
            
            <p>NOTE : Do NOT use this plugin on large datasets!</p>
            
            <ext:GridPanel 
                ID="GridPanel1" 
                runat="server"
                Width="400"
                Height="200"
                DisableSelection="true"
                Title="EditableGrid lugin">
                <Store>
                    <ext:Store runat="server">
                        <Reader>
                            <ext:JsonReader>
                                <Fields>
                                    <ext:RecordField Name="Enabled" Type="Boolean" />
                                    <ext:RecordField Name="Value" Type="Int" />
                                    <ext:RecordField Name="Text" Type="String" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <Plugins>
                    <ext:EditableGrid runat="server" />
                </Plugins>
                <View>
                    <ext:GridView runat="server" MarkDirty="false" />
                </View>
                <ColumnModel>
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:CheckColumn DataIndex="Enabled" Editable="true" >                       
                        </ext:CheckColumn>
                        <ext:Column 
                            Header="Value" 
                            DataIndex="Value" 
                            Width="130" 
                            Sortable="true">
                            <Editor>
                                <ext:NumberField runat="server" AllowBlank="false">
                                    <Listeners>
                                        <AfterRender Handler="this.setDisabled(!this.grid.record.get('Enabled'));" />
                                    </Listeners>
                                </ext:NumberField>
                            </Editor>
                        </ext:Column>
                        <ext:Column 
                            Header="Text" 
                            DataIndex="Text" 
                            Width="130" 
                            Sortable="true">
                            <Editor>
                                <ext:TextField runat="server" AllowBlank="false">
                                    <Listeners>
                                        <AfterRender Handler="this.setDisabled(this.grid.record.get('Enabled'));" />
                                    </Listeners>
                                </ext:TextField>
                            </Editor>
                        </ext:Column>
                    </Columns>
                </ColumnModel>
            </ext:GridPanel>
        </form>  
    </body>
    </html>
    Each editor contains reference on grid object (if you use EditableGrid plugin)
    grid:{
        grid: // grid instance
        record: //record
        cell: cell // cell element
        dataIndex: // dataindex name
        col:  // col index
        row: // row index 
    }

Similar Threads

  1. Gridview column style
    By sedgar in forum 1.x Help
    Replies: 1
    Last Post: Aug 04, 2011, 3:16 PM
  2. Replies: 2
    Last Post: Nov 12, 2010, 8:17 PM
  3. Handler/Fn for column (code behind)
    By roszman in forum 1.x Help
    Replies: 1
    Last Post: Apr 28, 2010, 5:36 AM
  4. [CLOSED] [1.0] Column Renderer Format/Handler
    By state in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 24, 2010, 7:49 PM
  5. Get Gridview Column value using c#
    By speedstepmem3 in forum 1.x Help
    Replies: 1
    Last Post: Nov 13, 2008, 9:25 AM

Posting Permissions