Nov 15, 2010, 11:02 AM
[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?
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]