Simple jQuery SlickGrid JSON example or documentation

后端 未结 4 678
感情败类
感情败类 2020-12-29 11:10

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 SlickG

4条回答
  •  情深已故
    2020-12-29 11:53

    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);
    

    ... and so on


    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. :

    
      
        
            
            
        
      
    
    

提交回复
热议问题