Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
605
How To Get The igGridPaging PageSize
posted

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 
Parents Reply Children
No Data