Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Problem with TreeGrid which loads JSON Datasource

$
0
0
Hi,

SmartClient_v100p_2015-03-24.

Here I try to built a Treegrid, which loads data with JSON format. BUT,only appears one node.What's wrong?

Thx.

here is TreeLoadJson.html
Code:


<HTML>
<HEAD>
        <SCRIPT>var isomorphicDir="isomorphic/";</SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Core.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Containers.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Grids.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Forms.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_DataBinding.js></SCRIPT>
        <SCRIPT SRC=isomorphic/skins/TreeFrog/load_skin.js></SCRIPT>

    <link href="css/connectors.css" rel="stylesheet" type="text/css" />
</HEAD>
<BODY>
<SCRIPT>

isc.DataSource.create
  ({
    ID:"TreeLoadJson_DS",
    dataURL:"js/TreeLoad.json",
    dataFormat:"json",
    fields:
            [
                {name:"Name"},
                {name:"Job"},
                {name:"EmployeeId", primaryKey:true, type:"integer", title:"Employee ID"},
                {name:"ReportsTo", foreignKey:"employees.EmployeeId", type:"integer", title:"Manager"}
            ]
        });


isc.TreeGrid.create
({
    ID: "employeeTree",
    dataSource: "TreeLoadJson_DS",
    autoFetchData: true,
    loadDataOnDemand: false,

    // customized appearance
    width: 500,
    height: 400,
    nodeIcon:"icons/16/person.png",
    folderIcon:"icons/16/person.png",
    showOpenIcons:false,
    showDropIcons:false,
    closedIconSuffix:""
});
 



</SCRIPT>
</BODY>

</HTML>


and here is Datasource:js/TreeLoad.json
Code:

{
    "Employees": {
        "employee": [
            {
                "Name": "Charles Madigen",
                "Job": "Chief Operating Officer",
                "EmployeeId": 4,
                "ReportsTo": 1
            },
            {
                "Name": "Rogine Leger",
                "Job": "Mgr Syst P P",
                "EmployeeId": 188,
                "ReportsTo": 4
            },
            {
                "Name": "Gene Porter",
                "Job": "Mgr Tech Plng IntIS T",
                "EmployeeId": 189,
                "ReportsTo": 4
            },
            {
                "Name": "Olivier Doucet",
                "Job": "Asset Spec Lines Stns",
                "EmployeeId": 265,
                "ReportsTo": 189
            },
            {
                "Name": "Cheryl Pearson",
                "Job": "Dsl Sys Rep",
                "EmployeeId": 264,
                "ReportsTo": 189
            }
        ]
    }
}

and here is the attach file.

Attached Images
File Type: png 20150407230403.png (3.7 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles