如何使用webservice方法将MongoDb Json值传递给KendoUI网格 [英] How to pass MongoDb Json value to KendoUI grid using webservice method

查看:126
本文介绍了如何使用webservice方法将MongoDb Json值传递给KendoUI网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是KendoUI的新手,尝试用JSON数据填充KendoUI网格,该数据从mongoDB作为BsonDocument lsit获取并作为JSON字符串返回,

  var ds = new kendo.data.DataSource({
transport:{
read:{
url:WebService.asmx / GetJson,
dataType:json,
data:{
q:data
}
}
},
模式:{
data: 状态
}
});

$(#grid)。kendoGrid({

dataSource:ds
});

我试过这个,网格对我没有约束力,当时我做错了,如何绑定我的数据到网格,请帮我等待好心的回复。



注意:网格不应该用列字段定义结构,基于Json字符串网格结构必须改变。

解决方案

我认为如果您是KendoUI的新手,您可能一次尝试做太多事情。试着将网格绑定到一些静态数据(硬编码到网页中),看起来与MongoDB中的数据完全相同...您应该可以使用MongoVue等简单的方法从MongoDB中提取此数据。



一旦您确定数据本身的格式正确并且网格配置为正确使用此格式,请尝试设置远程URL或Web服务来获取数据并确保从远程网址获取的数据就是你所期望的。

最后,当你有这两个难题的地方,你应该看看钩KendoUI网格直至远程Web服务。

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.

解决方案

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.

这篇关于如何使用webservice方法将MongoDb Json值传递给KendoUI网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆