[CLOSED] Raw property is null when adding a node

  1. #1

    [CLOSED] Raw property is null when adding a node

    Hi folks, when i append a node the raw property is null.

    to reproduce the problem, please do the following steps:
    • Click Append Child button
    • Select the appended node


    Any idea to overcome this issue?

    <script type="text/javascript">
        var appendChild = function () {
            Ext.net.DirectMethod.request({
                url: "/Example/GetNewChild",
                cleanRequest: true,
                success: function (result) {
                    App.TreePanel2.getRootNode().appendChild([result], false, true);
                }
            });
        }
    
        var selectNode = function (item,record,index) {
            if (record.raw == null) {
                alert("Raw is null");
            }
            else {
                alert("Raw is not null");
            }
        }
    </script>
    <ext:Button Text="Append Child" runat="server">
        <Listeners>
            <Click Handler="appendChild();" />
        </Listeners>
    </ext:Button>
    <ext:TreePanel ID="TreePanel2" SelType="Checkbox" runat="server" Title="Tree" Height="700"
        Width="400" Margins="10" RootVisible="false" Border="false">
        <Listeners>
            <Select Fn="selectNode" />
        </Listeners>
        <Store>
            <ext:TreeStore ID="TreeStore1" runat="server">
                <Proxy>
                    <ext:AjaxProxy Url="/Example/LoadFakeChildren">
                        <ActionMethods Read="POST" />
                        <Reader>
                            <ext:JsonReader Root="data" />
                        </Reader>
                    </ext:AjaxProxy>
                </Proxy>
            </ext:TreeStore>
        </Store>
        <Root>
            <ext:Node NodeID="0" Text="Root" />
        </Root>
        <Fields>
            <ext:ModelField Name="Task" />
        </Fields>
        <ColumnModel>
            <Columns>
                <ext:TreeColumn ID="TreeColumn1" runat="server" Text="Task" Flex="2" Sortable="true"
                    DataIndex="Task" />
            </Columns>
        </ColumnModel>
    </ext:TreePanel>
    public AjaxResult GetNewChild()
    {
        AjaxResult result = new AjaxResult();
    
        result.Result = new { Task = "raphael" };
    
        return result;
    }
    
    public StoreResult LoadFakeChildren()
    {
        NodeCollection nodes = new NodeCollection(false);
    
        for (int index = 1; index < 6; index++)
        {
            Node no = new Node();
            no.NodeID = index.ToString() + DateTime.Now.Second;
            no.CustomAttributes.Add(new ConfigItem { Name = "Task", Value = no.NodeID, Mode = ParameterMode.Value });
            nodes.Add(no);
        }
    
        return new StoreResult { Data = nodes.ToJson() };
    }
    Last edited by geoffrey.mcgill; Jun 22, 2012 at 10:27 PM. Reason: [CLOSED]
  2. #2
    CustomAttribute name must be presented in Model as ModelField (or inside Fields collection of TreePanel)
    See
    https://examples2.ext.net/#/TreePane...nced/TreeGrid/
    Last edited by Vladimir; Jun 22, 2012 at 9:05 PM.
  3. #3
    take a look on line 27
  4. #4
    If you use a store then fields must be defined inside Model of that Store
    We will add exception if Fields of TreePanel is used with Store
  5. #5
    Thank you, please mark it as closed

Similar Threads

  1. [CLOSED] Adding additional markup to selected TreePanel node
    By mbb in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 22, 2011, 3:06 PM
  2. [CLOSED] Adding Tag Property to all fields
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Nov 14, 2011, 5:52 PM
  3. [CLOSED] Adding node dynamicaly to treegrid on client side
    By bakardi in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 22, 2011, 6:38 AM
  4. Replies: 0
    Last Post: Sep 29, 2011, 4:46 PM
  5. [CLOSED] Problem when adding a Tree Node from Javascript
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 15, 2010, 9:45 AM

Posting Permissions