This is a migrated thread and some comments may be shown as answers.
treeview works in local json data, not remote data why?
0 Answers 86 Views
This is a migrated thread and some comments may be shown as answers.
max
Top achievements
Rank 1
max asked on 13 Aug 2012, 06:29 PM
I had a treeview, I got the json data from server side, and tried to bind it to treeview, but it didn't work, return all "undefined", but the same data I copied them into local, then hard code them into the treeview, it work fine, why ?

 1) below is my code.
<script type="text/javascript">
    $(function () {
        $.getJSON('@Href("~/api/TrackingCodes/action/GetPageTree/?orgID=17&typeIds={\"1\", \"2\", \"10\"}")', function (ret) {
            var Sitetrees = new kendo.data.HierarchicalDataSource({
                data: ret,
                schema: {
                    model: {
                        id: "Value",
                        children: "Node"
                    }
                }
            });
            $("#DivPageTree").kendoTreeView({
                dataSource: Sitetrees,
                dataTextField: "Text"
            });
        })
    })
</script>



2) It works when I copied these data into local

<script type="text/javascript">
             var Sitetrees = new kendo.data.HierarchicalDataSource({
                data: [...................],
                schema: {
                    model: {
                        id: "Value",
                        children: "Node"
                    }
                }
            });
            $("#DivPageTree").kendoTreeView({
                dataSource: Sitetrees,
                dataTextField: "Text"
            });
</script>

No answers yet. Maybe you can help?

Asked by
max
Top achievements
Rank 1
Share this question
or