PDA

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



Django
Jul 17, 2013, 2:27 PM
Hi
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">
<Fields>
<ext:ModelField Name="step"/>
<ext:ModelField Name="target"/>
<ext:ModelField Name="process"/>

</Fields>
<ColumnModel>
<Columns>
<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" >
<Items>
<ext:ActionItem Tooltip="Edit" Icon="PageWhiteEdit"></ext:ActionItem>
</Items>
</ext:ActionColumn>
</Columns>
</ColumnModel>

</ext:TreePanel>


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));
root.Children.Add(child);
stepTree.Root.Add(root);
stepTree.Render();


Thanks

Daniil
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.

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