How to pass MongoDb Json value to KendoUI grid usi

2019-07-29 11:01发布

I'm new to KendoUI, trying to populate a KendoUI grid with JSON data which is fetched from mongoDB as BsonDocument lsit and returned as JSON string,

var ds = new kendo.data.DataSource({
 transport: {
       read: {
            url: "WebService.asmx/GetJson",
            dataType: "json",
            data: {
                 q: "data"
              }
            }
        },
        schema: {
            data: "statuses"
        }
    });

    $("#grid").kendoGrid({

        dataSource: ds
    });

I tried this one, grid is not binding to me, was I'm doing wrong, how to bind my data to grid, pls help me waiting for kind reply.

note: Grid should not be defined structure with column fields, based on Json string grid structure has to changed.

1条回答
Emotional °昔
2楼-- · 2019-07-29 11:30

I think you're probably trying to do too many things at once if you're new to KendoUI. Try just binding the grid to some static data (hard coded into the web page) that looks exactly like the data from MongoDB first... You should be able to extract this from MongoDB easily enough using something like MongoVue.

Once you're sure the data itself is in the right format and the grid is configured to use this properly, then try setting up a remote url or web service to fetch the data and make sure that the data retrieved from the remote url is what you're expecting.

Finally, when you have both of those pieces of the puzzle in place, you should look at hooking the KendoUI grid up to the remote web service.

查看更多
登录 后发表回答