2014-05-10 77 views
1

KendoUI电网页脚演员我也正从我的PHP脚本返回以下JSON来填充我的剑道格:从返回的JSON

data: [{id:1, sku:-, theName:Two tier wedding veil, basePrice:77.00, dimensions:-, weight:-,…},…] 
querytime: "0.0000" 
rowcount: 4 

伟大的工程。正如你所看到的,我添加了一个名为“querytime”的额外参数。

如何访问JS端的东西,以便我可以将它附加到网格的页脚?

我曾尝试:

console.log($('#productGrid').data("kendoGrid").dataSource); 

,试图找到我的额外参数所在的位置信息,但无济于事。

如何访问我的客户参数?


var columns = [ 
    { 
     field: 'dateRaw', 
     title: 'Date added', 
     width: '90px', 
     template: '<span class="data" data-menu-id="1" data-item-id="#=id#" data-item-type="products"><abbr title="At #=time#">#=dateFormatted#</abbr></span>' 
    }, 
    { 
     field: 'sku', 
     title: 'SKU', 
     width: '120px' 
    }, 
    { 
     field: 'theName', 
     title: 'Name' 
    }, 
    { 
     field: 'dimensions', 
     title: 'Dimensions', 
//width: '120px' 
    }, 
    { 
     field: 'weight', 
     title: 'Weight', 
     width: '80px' 
    }, 
    { 
     field: 'basePrice', 
     title: 'Price', 
     width: '60px', 
     format: '{0:n}' 
    }] 

$('#productGrid').kendoGrid({ 
    rowTemplate: '', 
    dataSource: { 
     transport: { 
      read: { 
       type: 'POST', 
       dataType: 'json', 
       url: 'Ajax', 
       data: { 
        call: 'Product->productGrid' 
       } 
      } 
     }, 
     schema: { 
      data: 'data', 
      querytime: 'querytime', 
      total: 'rowcount', 
      model: { 
       id: 'id', 
       fields: { 
        dateRaw: { 
         type: 'date' 
        }, 
        id: { 
         type: 'number' 
        }, 
        sku: { 
         type: 'string' 
        }, 
        basePrice: { 
         type: 'number' 
        } 
       } 
      } 
     }, 
     pageSize: 20, 
     serverPaging: true, 
     serverFiltering: true, 
     serverSorting: true, 
     error: function(e) { 
      modalError(e.errorThrown + "<br/>" + e.status + "<br/>" + e.xhr.responseText) 
     } 
    }, 
    height: 700, 
    autoBind: false, 
    filterable: true, 
    sortable: true, 
    pageable: true, 
    columns: columns 
}) 

回答

0

你是相当接近: querytime可以在您的数据源的选择对象中:

$('#productGrid').data('kendoGrid').dataSource.options.querytime 
+0

当我CONSOLE.LOG,我不能看到我的自定义参数的任何地方:( – imperium2335

+0

你如何初始化你的kendogrid? –

+0

请看我的编辑 – imperium2335