PDA

View Full Version : [CLOSED] here how to get value of modelfield in editor?



hdsoso
Jun 02, 2014, 3:43 AM
<%@ Page Language="C#" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{

}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" SourceFormatting="True"></ext:ResourceManager>
<ext:TreePanel runat="server">
<Store>
<ext:TreeStore runat="server">
<Model>
<ext:Model runat="server" IDProperty="sid">
<Fields>
<ext:ModelField Name="sid"></ext:ModelField>
<ext:ModelField Name="sname"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="1" Expanded="True">
<CustomAttributes>
<ext:ConfigItem Name="sid" Value="1"></ext:ConfigItem>
<ext:ConfigItem Name="sname" Value="student1"></ext:ConfigItem>
</CustomAttributes>
<Children>
<ext:Node NodeID="2" Leaf="True">
<CustomAttributes>
<ext:ConfigItem Name="sid" Value="2"></ext:ConfigItem>
<ext:ConfigItem Name="sname" Value="student2"></ext:ConfigItem>
</CustomAttributes>
</ext:Node>
</Children>
</ext:Node>
</Root>
<ColumnModel>
<Columns>
<ext:TreeColumn runat="server" DataIndex="sid" Text="sid"></ext:TreeColumn>
<ext:Column runat="server" DataIndex="sname" Text="sname" Flex="1">
<Editor>
<ext:TextField runat="server">
<Listeners>
<Blur Handler="
alert(item);//here how to get value of modelfield 'sid', the old value and new value of textfield?

" />

</Listeners>
</ext:TextField>
</Editor>
</ext:Column>
</Columns>

</ColumnModel>
<Plugins>
<ext:CellEditing runat="server"></ext:CellEditing>
</Plugins>
</ext:TreePanel>
</form>
</body>
</html>

Daniil
Jun 02, 2014, 8:23 AM
Hi @hdsoso,

A TextField doesn't track its values (old and new) on the Blur event.

Please use a CellEditing's Edit event.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.plugin.CellEditing-event-edit