View Full Version : [CLOSED] TreePanel(grid) CustomAttributes doesn't work (code behind)

Jul 17, 2013, 2:27 PM
i want add nodes to treegrid. but i got some errors

when i use this format , i got the js error : scenarioname is undefined

root.CustomAttributes.Add( new ConfigItem("step", selectedScenario.Name.ToString() , Ext.Net.ParameterMode.Raw));

when i use this format it works but it looks like a bug.

root.CustomAttributes.Add( new ConfigItem("step","'" + selectedScenario.Name.ToString() + "'" , Ext.Net.ParameterMode.Raw));

markup treepanel

<ext:TreePanel ID="stepTree" runat="server" RootVisible="true" FolderSort="true" SingleExpand="true" UseArrows="true" Title="title">
<ext:ModelField Name="step"/>
<ext:ModelField Name="target"/>
<ext:ModelField Name="process"/>

<ext:TreeColumn runat="server" Sortable="true" Text="Adımlar" Flex="2" DataIndex="step"></ext:TreeColumn>
<ext:Column runat="server" Sortable="true" Text="Hedefler" Flex="1" DataIndex="target"></ext:Column>
<ext:Column runat="server" Sortable="true" Text="İşlem" Flex="1" DataIndex="process"></ext:Column>
<ext:ActionColumn runat="server" Text="Edit" Width="40" Align="Center" >
<ext:ActionItem Tooltip="Edit" Icon="PageWhiteEdit"></ext:ActionItem>


cs (working version)

Ext.Net.Node root = new Ext.Net.Node
NodeID = selectedScenario.ID + "root",
Expanded = true,
Icon = Ext.Net.Icon.Pencil
root.CustomAttributes.Add( new ConfigItem("step","'" + selectedScenario.Name.ToString() + "'" , Ext.Net.ParameterMode.Raw));
Ext.Net.Node child = new Ext.Net.Node
NodeID = "1",
Expanded = true,
Icon = Ext.Net.Icon.Pencil,
Leaf = true
child.CustomAttributes.Add(new ConfigItem("step", "'" + selectedScenario.Name.ToString() + "'", Ext.Net.ParameterMode.Raw));


Jul 17, 2013, 4:09 PM
Hi @Django,

You should use ParameterMode.Value instead of ParameterMode.Raw.

root.CustomAttributes.Add( new ConfigItem("step", selectedScenario.Name.ToString(), Ext.Net.ParameterMode.Value));

The Raw mode means that a value will be rendered without wrapping quotes, so, not a string.

You can use the Raw mode if you need, for example, a JavaScript function or an int value.

Jul 17, 2013, 4:12 PM
I got it (:
Thanks (: