Kendo Grid - Child Navigation Binding Issues

爷,独闯天下 提交于 2019-12-11 09:06:34

问题


I am trying to call a web api method and return this data to a kendo grid and display this data in my grid. The model that is returned from my web api method has navigation properties that have other objects, and I am just trying to display these navigation elements in my grid using a kendo template. However, I am having problems with it not being able to detect that the navigation property exists, even though I can see it when I debug.

 //schema for my kendo data source
 schema: {
              data: function (data) { //specify the array that contains the data
                    console.log("This object has a FREQ_POOL object, and it contains data");
                    console.log(data);

                    var tmp = [{ FREQ_POOL: { IsAM: 'Jane', last: 'Doe' } }, { FREQ_POOL: { IsAM: "John", last: 'Doe' } }];
                    console.log("This object has the same structure and is manually created, and it works if I return it from her in my grid);
                    console.log(tmp);
                  //return tmp; THIS WORKS
                  return  data;  This throws the error FREQ_POOL is undefined
                },                
        }
......................................................
 $("#FAAFreqGrid").kendoGrid({
        dataSource: FAADS,

        columns: [

                { field: "FREQ_POOL", template: "<strong>#: FREQ_POOL.IsAM# </strong>", title: "FAATEST", format: "{0:c}", width: "120px" },
            { command: ["edit", "destroy"], title: "&nbsp;", width: "250px" }
        ],
        toolbar: ["create"],
        editable: "inline",
        pageable: true

    });

When I look at the objects both console.logs return, they look identical in structure. Both have a FREQ_POOL with an IsAM set. But if I return "data" instead of "tmp", I get the error

`"Uncaught ReferenceError: FREQ_POOL is not defined"`.

So for some reason even though both objects look identical, FREQ_POOL is not being detected in "data", but is in "tmp"

来源:https://stackoverflow.com/questions/29015105/kendo-grid-child-navigation-binding-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!