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

Problems with grid hierarchy

2 Answers 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fernando
Top achievements
Rank 1
Fernando asked on 24 Jan 2012, 04:43 PM
Hello everybody,

i'm trying to make one grid with Hierarchy, but the hierarchy grid return all rows everytime.

To populate the grids, i have two json files:
-OS.json to principal;
-ITEM.json to hierarchy grid;

OS.json:
[{"cdOS":474103,"cdSelb":"X112","solicitante":"CLEBSON "},
{"cdOS":474104,"cdSelb":"A335","solicitante":"FERNANDO "}]

ITEM.json:
[{"cdOS":474103,"status":"ABERTO","usuario":"nivaldo.oliveira"},
{"cdOS":474103,"status":"FECHADO","usuario":"carlos.alberto"},
{"cdOS":474104,"status":"ABERTO","usuario":"nivaldo.oliveira"},
{"cdOS":474104,"status":"FECHADO","usuario":"carlos.alberto"}]



<div id="grid"> </div>

                $(document).ready(function() {
                    var element = $("#grid").kendoGrid({
                        dataSource: {
                            type: "json",
                            pageSize: 10,
                            serverPaging: true,
                            serverFiltering: true,
                            serverSorting: true,
                            transport: {
                                read: {
                                    url: "js/OS.json",
                                    dataType: "json"
                                },
                                schema: {
                                    model: {
                                        fields: {
                                            cdOS: { type: "number" },
                                            cdSelb: { type: "string" },
                                            solicitante: { type: "string" }
                                        }
                                    }
                                }
                            }
                        },
                        height: 550,
                        filterable: true,
                        sortable: true,
                        pageable: true,
                        detailInit: detailInit,
                        dataBound: function() {
                            this.expandRow(this.tbody.find("tr.k-master-row").first());
                        },
                        columns: [{
                            field: "cdOS",
                            title: "OS"
                        },
                        {
                            field: "cdSelb",
                            title: "SELB"
                        },
                        {
                            field: "solicitante",
                            title: "Solicitante"
                        }]
                        });
                    });

                function detailInit(e) {
                    $("<div/>").kendoGrid({
                        dataSource: {
                            type: "json",
                            transport: {
                            read: {
                                url: "js/ITEM.json",
                                dataType: "json"
                                },
                                schema: {
                                    model: {
                                        fields: {
                                            cdOS: { type: "number" },
                                            status: { type: "string" },
                                            usuario: { type: "string" }
                                        }
                                    }
                                }                                
                            },
                            serverPaging: true,
                            serverSorting: true,
                            serverFiltering: true,
                            pageSize: 6,
                            filter: { field: "cdOS", operator: "eq", value: e.data.cdOS }
                        },
                        scrollable: true,
                        sortable: true,
                        pageable: true,
                        columns: ["cdOS", "status","usuario"]
                    }).appendTo(e.detailCell);
                }


Anybody can help-me to resolve this issue?
I wanna to return only two rows in hierarchy grid, for one row in principal grid, the link is "CdOS".

Thanks!

2 Answers, 1 is accepted

Sort by
0
Joel
Top achievements
Rank 1
answered on 27 Jan 2012, 03:02 AM
Can you set this up in a jsfiddle (http://jsfiddle.net/) to reproduce what you are trying to achieve?
0
Umesh
Top achievements
Rank 1
answered on 25 Mar 2014, 04:59 PM
Try doing Fetch, group
Tags
Grid
Asked by
Fernando
Top achievements
Rank 1
Answers by
Joel
Top achievements
Rank 1
Umesh
Top achievements
Rank 1
Share this question
or