[CLOSED] TreePanel(grid) CustomAttributes doesn't work (code behind)

  1. #1

    [CLOSED] TreePanel(grid) CustomAttributes doesn't work (code behind)

    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
    Last edited by Daniil; Jul 17, 2013 at 4:40 PM. Reason: [CLOSED]
  2. #2
    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.
  3. #3
    I got it (:
    Thanks (:

Similar Threads

  1. [CLOSED] visible in code behind doesn't work for portlet
    By CarpFisher in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 29, 2012, 12:30 PM
  2. Replies: 2
    Last Post: Mar 15, 2012, 12:57 AM
  3. Replies: 3
    Last Post: Sep 17, 2009, 11:44 AM
  4. Replies: 5
    Last Post: May 13, 2009, 12:10 PM
  5. Replies: 2
    Last Post: Nov 04, 2008, 12:28 AM

Posting Permissions