简单的jQuery SlickGrid JSON例子或文档 [英] Simple jQuery SlickGrid JSON example or documentation

查看:327
本文介绍了简单的jQuery SlickGrid JSON例子或文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找如何尝试通过jQuery.Ajax检索数据为JSON时使用SlickGrid一个简单的例子。 我也无法找到SlickGrid插件的任何文件,并想知道如果我只是找错了地方。 任何让我开始与SlickGrid帮助将是最AP preciated。

I'm looking for a simple example on how to use SlickGrid when trying to retrieve the data as JSon via jQuery.Ajax. I was also unable to find any documentation of the SlickGrid plugin and was wondering if I was just looking in the wrong places. Any help to get me started with SlickGrid would be most appreciated.

推荐答案

在一个asp.net页面的一个例子。该web服务的myData 返回需要匹配网格列一个JSON字符串。

An example within an asp.net page. The webservice myData returns a json string that needs to match the grid columns.

$(function () {

        $.ajax({
            url: "WS.asmx/myData",
            global: false,
            type: "POST",
            data: "{}",
            contentType: "application/json",
            dataType: "json",
            async: false,
            success: function (json) {
                data = eval('(' + json.d + ')');
                if (!data) { alert('no data'); };
            },
            error: function (msg) {
                var errorText = eval('(' + msg.responseText + ')');
                alert('Error : \n--------\n' + errorText.Message);
            }
        }

        );

 if (data) {
    dataView = new GridNic.Data.DataView();
    grid = new GridNic.Grid($("#myGrid"), dataView.rows, columns, options);
    var pager = new GridNic.Controls.Pager(dataView, grid, $("#pager"), columns);
    var columnpicker = new GridNic.Controls.ColumnPicker(columns, grid, options);

...等

在Asp.Net,JSON字符串的大小默认情况下限制。如果出现问题,你必须在web.config如申报尺寸较大

In Asp.Net, the size of the json string is restricted by default. In case of trouble you have to declare a larger size in the web.config e.g. :

<system.web.extensions>
  <scripting>
    <webServices>
        <jsonSerialization maxJsonLength="5000000">
        </jsonSerialization>
    </webServices>
  </scripting>
</system.web.extensions>

这篇关于简单的jQuery SlickGrid JSON例子或文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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