从代码将页面大小值分配给剑道网格
Posted
技术标签:
【中文标题】从代码将页面大小值分配给剑道网格【英文标题】:Assign page size value to kendo grid from code 【发布时间】:2012-06-24 23:21:16 【问题描述】:代码:
var dataSource = new kendo.data.DataSource(
transport:
read:
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
data:
q: "kendoui"
,
schema:
data: "results",
total: function(response)
return response.results.length;
,
pageSize: 4
);
这里我必须从客户端设置页面大小 4
【问题讨论】:
【参考方案1】: public JsonResult GetSettings()
return Json(new count = Service.GetSettings<UserSetting>(AuthenticatedUser) , JsonRequestBehavior.AllowGet);
var settingsDataSource = new kendo.data.DataSource(
transport:
read:
url: '@Url.Action("GetSetting")',
dataType: "json",
type: "GET"
,
schema:
parse: function (data)
resultCount = data.count;
return data;
,
change: function ()
Grid();
);
settingsDataSource.read();
function Grid()
mainGridDataSource = new kendo.data.DataSource(
transport:
read:
url: '@Url.Action("GetDetails")',
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8"
,
parameterMap: function (options)
return JSON.stringify( filter: options, isPrimary: options.isPrimary );
,
schema:
model:
fields:
Status: type: "string" ,
Name: type: "string"
,
data: function (data)
return data.data;
,
total: function (data)
return data.totalCount;
,
pageSize: resultCount,
serverFiltering: true,
serverPaging: true
);
【讨论】:
***.com/questions/11330474/…以上是关于从代码将页面大小值分配给剑道网格的主要内容,如果未能解决你的问题,请参考以下文章
剑道 - 通过页面上的代码保存网格过滤器仅存在日期过滤器网格列的问题