如何在按钮单击中而不是页面加载中加载剑道网格数据 [英] How to load the kendo grid data in button click not in page load

查看:77
本文介绍了如何在按钮单击中而不是页面加载中加载剑道网格数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有kendo网格和图表.我也有按钮.在页面加载时,所有数据都在网格和图表中加载.但是我想在按钮中加载数据,而不是在页面加载中单击.在页面加载中,网格和图表将为空.当我们单击按钮时,数据将被加载到网格和图表中.如何执行此任务.如果有人对此有所了解,请帮助我. 我的网格代码是

I have kendo grid and chart in my application.And I have button also.At the time of page load all the data is loading in grid and chart.But i want to load the data in button click not in page load.In page load grid and chart will be empty.When we click on button data will be loaded in grid and chart.How to do this task.If any one know about this please help me. My grid code is

 var grid = $("#grid").kendoGrid({
autoBind:false,
dataSource: undefined,
pageable  : {
    pageSize : 10,
    refresh  : true,
    pageSizes: [10, 20]
},
columns   : [
    {
        field     : "OrderID",
        filterable: false
    },
    "Freight",
    {
        field : "OrderDate",
        title : "Order Date",
        width : 100,
        format: "{0:MM/dd/yyyy}"
    },
    {
        field: "ShipName",
        title: "Ship Name",
        width: 200
    },
    {
        field: "ShipCity",
        title: "Ship City"
    }
]

               }).data("kendoGrid");

我的小提琴是 http://jsfiddle.net/5bchz/103/

推荐答案

要在页面加载时停止自动加载网格,

To stop auto loading the grid when the page load,

$("#grid").kendoGrid({
   autoBind: false,
   dataSource: dataSource
});

http://docs.kendoui.c​​om/api/web/grid#configuration-autoBind

然后将网格设置为要加载,您需要将其放在onlick按钮上,

Then to set the grid to load you would need to put this in on the button onlick,

theGrid.dataSource.read()

或者在jquery函数中,因此您可以轻松更改要随其传递的参数.

Or in a jquery function so you can easily change which parameters you want to pass in with it.

这篇关于如何在按钮单击中而不是页面加载中加载剑道网格数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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