[CLOSED] Textfield editor in GridPanel: change string appereance before edit

  1. #1

    [CLOSED] Textfield editor in GridPanel: change string appereance before edit

    Hi,
    i have a textfield editor in a grid-panel. The column shows a list of ints: "1,2,3,4".
    This is fine, but when the editor starts, i'd like that the textfield starts with the string "1234" with no punctation.

    I'm not able to set that field value.
    I tried BeforeStartEdit & StartEdit but none seems to work.

    Any hints?

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
    
        protected void Page_Load(object sender, EventArgs e)
        {
            this.DataStore.DataSource = this.GetData();
            this.DataStore.DataBind();
        }
    
        private List<Data> GetData()
        {
            return new List<Data>
            {
                new Data { Id = 1, Name = "Data1", Integers = new List<int> { 1, 1 } },
                new Data { Id = 2, Name = "Data2", Integers = new List<int> { 2, 2 } },
                new Data { Id = 3, Name = "Data3", Integers = new List<int> { 3, 3 } },
                new Data { Id = 4, Name = "Data4", Integers = new List<int> { 4, 4 } },
                new Data { Id = 5, Name = "Data5", Integers = new List<int> { 5, 5} },
            };
        }
        
        public class Data
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public IEnumerable<int> Integers { get; set; }
        } 
    </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>
        <script type="text/javascript" src="http://localhost/js/jquery-1.4.2.js"></script>
        <script type="text/javascript" src="http://localhost/js/Log.js"></script>
    
        <script type="text/javascript">
    
        </script>   
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager" runat="server" ScriptMode="Debug" />
    
        <ext:Store runat="server" ID="DataStore">
            <Reader>
                <ext:JsonReader IDProperty="Id"> 
                    <Fields>
                        <ext:RecordField Name="Id" Type="Int" />
                        <ext:RecordField Name="Name" Type="String"/>
                        <ext:RecordField Name="Integers" IsComplex="true" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <SortInfo Field="Id" Direction="ASC" />
        </ext:Store>   
    
         <ext:GridPanel
            runat="server" 
            ID="GridPanel"
            StoreID="DataStore"
            Title="Table" 
            Icon="Table"
            Frame="true"
            AutoHeight="true"
            Width="400">
             <ColumnModel runat="server">
                 <Columns>
                     <ext:Column Header="ID" DataIndex="Id" ColumnID="id" />
                     <ext:Column Header="Name" DataIndex="Name" ColumnID="name" />
                     <ext:Column Header="Integers" DataIndex="Integers" ColumnID="ints">
                        <Editor>
                            <ext:TextField runat="server" MaskRe="[0-9]" />
                        </Editor>
                        <EditorOptions>
                            <Listeners>
    
                            </Listeners>
                        </EditorOptions>
                     </ext:Column>
                 </Columns>
             </ColumnModel>
             <SelectionModel>
                <ext:RowSelectionModel runat="server" />
             </SelectionModel>
        </ext:GridPanel>
    </body>
    </html>
    Last edited by Daniil; Nov 15, 2010 at 1:05 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please try the following thing.

    Example
    <EditorOptions>
        <Listeners>
            <StartEdit Handler="this.setValue('1234')"/>
        </Listeners>
    </EditorOptions>
  3. #3
    Solved. Thanks

Similar Threads

  1. Replies: 1
    Last Post: Feb 19, 2012, 1:07 PM
  2. Gridpanel textfield editor
    By naina in forum 1.x Help
    Replies: 5
    Last Post: Aug 22, 2011, 1:02 PM
  3. Replies: 2
    Last Post: Oct 28, 2010, 8:59 PM
  4. Gridpanel Editor - Textfield Context Menu
    By Tbaseflug in forum 1.x Help
    Replies: 7
    Last Post: Sep 15, 2009, 8:43 PM
  5. GridPanel: Edit Row inside Form TextField
    By OneWingedAngel in forum 1.x Help
    Replies: 7
    Last Post: Dec 09, 2008, 5:54 PM

Posting Permissions