This is a migrated thread and some comments may be shown as answers.

Hierarchical grid (Invalid template:'<tr data-uid="#=uid#">)...

2 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Krish
Top achievements
Rank 1
Krish asked on 19 Jun 2012, 05:23 PM
Hi,

WCF Service returning JSON string for hierarchical grid. While binding to grid, I am getting following error. In examples I found two different services calling for Parent and Child. My requirement is one JSON string with hierarchical gird.

Invalid template:'<tr data-uid="#=uid#"><td>${All}</td><td>${sample name}</td></tr>' Generated code:'var o,e=kendo.htmlEncode;with(data){o='<tr data-uid="'+(uid)+'"><td>'+(e(All))+'</td><td>'+(e(sample name))+'</td></tr>';}return o;'


  <div id="example" class="k-content">
        <div id="grid">
        </div>
        <script type="text/javascript">
            $(function () {
                dataSource = new kendo.data.DataSource({
                    schema: {
                        model: {
                            id: "_grdData"
                        }
                    },
                    pageSize: 10,
                    transport: {
                        read: { url: "/Service.svc/GetData", datatype: "json", type: "GET" },
                        parameterMap: function (data, operation) {
                            if (operation != "read") {
                                return JSON.stringify({ Service : data })
                            }
                        }
                    }
                }),


                $("#grid").kendoGrid({
                    dataSource: dataSource,
                    pageable: true,
                    scrollable: {
                        virtual: false //false
                    },
                    detailInit: detailInit,
                    dataBound: function () {
                        this.expandRow(this.tbody.find("tr.k-master-row").first());
                    },
                    toolbar: ["create"],
                    editable: "popup",
                    columns: [
                            { field: "name", title: "Name", width: "150px" }


                     ]


                });
            });

            function detailInit(e) {
console.log("Name: " + e.data.child[0].name );
                console.log("Name1:" + e.data.child[0].name1 );
                $("<div/>").appendTo(e.detailCell).kendoGrid({
                    dataSource: dataSource,
                    filter: { field: "id", operator: "eq", value: e.data.id},
                    columns: [
                        { field: e.data.child[0].name, title: "Name", width: "150px" },
{ field: e.data.child[0].name1, title: "Name 1", width: "150px" } 
              ]
                });
            }
        </script>
    </div>

JSon Data from service :
[{"name":"All","id":5369,"child":[{"name":"All","id":5369,"child":null,"name1":"sample name"}],"name1":null}]

2 Answers, 1 is accepted

Sort by
0
Krish
Top achievements
Rank 1
answered on 20 Jun 2012, 02:31 PM
Admin, Can you please look in to it.
0
Krish
Top achievements
Rank 1
answered on 26 Jun 2012, 07:32 PM
No one has idea about my issue? Admin can you please help me in this. No able to implement whout ur response.
Tags
Grid
Asked by
Krish
Top achievements
Rank 1
Answers by
Krish
Top achievements
Rank 1
Share this question
or