hello
I have a difficult problem. that is how to get the igGridPaging PageSize
Code:
@Url.StyleHref("~/Styles/home.css") @Url.StyleHref("~/Styles/themes/base/jquery.ui.all.css") @Url.StyleHref("~/Styles/themes/base/infragistics.css") @Url.ScriptSrc("~/Scripts/jquery.js") @Url.ScriptSrc("~/Scripts/jquery-ui.js") @Url.ScriptSrc("~/Scripts/jquery.unobtrusive-ajax.js") @Url.ScriptSrc("~/Scripts/jquery.hotkeys.js") @Url.ScriptSrc("~/Scripts/jquery.validate.js") @Url.ScriptSrc("~/Scripts/jquery.validate.unobtrusive.js") @Url.ScriptSrc("~/Scripts/bg.core.js") @Url.JavaScriptLocalize() @Url.ScriptSrc("~/Scripts/infragistics.js") @Url.ScriptSrc("~/Scripts/infragistics.loader.js") @Url.ScriptSrc("~/Scripts/jquery.form.js")
this is my javascript
then:
@using Infragistics.Web.Mvc; <input type="button" value="GetData" id="btnGetData" /> <div id="igGrid"> </div> <script type="text/javascript" language="javascript"> var gridPageSize = 10; //每页显示条数 $("#igGrid").igGrid({ autoGenerateColumns: false, columns: [ { headerText: "Number", key: "Number", dataType: "number" }, { headerText: "Name", key: "Name", dataType: "string" }, { headerText: "Year", key: "Year", dataType: "number" } ], dataSource: null, responseDataKey: "Records", //设置返回字符串中属于数据的字段 responseTotalRecCountKey: "TotalRecordsCount", //设置返回字符串中属于数据总条数的列 features: [ { name: "Paging", //使用分页 pageSize: gridPageSize, type: "remote", //以返回的数据为主[必须] recordCountKey: 'TotalRecordsCount', //设置返回字符串中属于数据总条数的列 pageIndexChanging: function (ui, args) { //当页数发生变化之前[可不使用] }, pageIndexChanged: function (ui, args) { //当页数发生变化之后,需要分页的 请务必实现此方法,使用ajax方式,进行取数据 var pageNo = args.pageIndex; PagingByNoAndSize(pageNo, gridPageSize); }, pageSizeChanging: function (ui, args) { }, pageSizeChanged: function (ui, args) { gridPageSize = args.pageSize; PagingByNoAndSize(0, gridPageSize); } } ] }); $("#btnGetData").bind("click", function () { $("#igGrid").igGridPaging("pageSize", 20) PagingByNoAndSize(0, gridPageSize); }) function PagingByNoAndSize(page, pageSize) { $.ajax({ type: "POST", url: '@Url.Action("GetData")', data: { "page": page, "pageSize": pageSize }, success: function (data) { $("#igGrid").igGrid("option", "dataSourceType", "json"); $("#igGrid").igGrid("option", "dataSource", data); }, error: function (error) { alert(error.toString()) } }) } </script>
when i run to the red code.
no answer .
who to change the pagesize and how to get it ?
thank you
Hello LostonZhang,
Thank you for posting in the community.
You can get/set thepageSizeoption for the grid using something similar to:
//Initialize $(".selector").igGrid({ features : [ { name : "Paging", pageSize : 10 } ] }); //Get var pageSize = $(".selector").igGridPaging("option", "pageSize"); //Set $(".selector").igGridPaging("option", "pageSize", 10);
//Initialize
$(
".selector"
).igGrid({
features : [
{
name :
"Paging"
,
pageSize : 10
}
]
});
//Get
var
pageSize = $(
).igGridPaging(
"option"
"pageSize"
);
//Set
, 10);
More information on that topic can be found in our API documentation:
http://help.infragistics.com/jQuery/2012.1/ui.iggridpaging
You may also find useful information regarding igGrid paging at:
http://help.infragistics.com/NetAdvantage/jquery/2012.1?page=igGrid_Paging.html
Please let me know if this helps.
thanks for you Reply.but on my page when i alert the
var pageSize = $(".selector").igGridPaging("option", "pageSize");
the result is