jQuery表格插件GridManager应用笔记

写在前面:处理前拿到接口返回列表对象数据Obj(包括List和RecordCount)Search(上次获取列表所传参数),批量删除的数据列checkedList

1.GridManager单个删除最后一页最后一条数据场景处理

在删除完成并成功后

if(Obj.List.length == 1 && Search.PageIndex > 1){
    GridManager.setQuery('DataGrid', Search,--Search.PageIndex);
}else{
    GridManager.refreshGrid('DataGrid');
}

2.批量删除后场景处理

同上

if(Search.PageIndex > 1){
    var myPage = 0;
    var fromNowOn = Obj.RecordCount - (Search.PageIndex-1)*Search.PageSize;
    if(checkedList.length >= fromNowOn){
        if(checkedList.length == fromNowOn){
            myPage = 1;
        }else{
            myPage = Math.ceil((checkedList.length-fromNowOn)/Search.PageSize);
        }
    }
    if(myPage != 0){
        Search.PageIndex = Search.PageIndex-myPage;
        GridManager.setQuery('DataGrid', Search,Search.PageIndex);
    }else{
        GridManager.refreshGrid('DataGrid');
    }
}else{
    GridManager.refreshGrid('DataGrid');
}
posted @ 2020-11-17 14:09  存在过?  阅读(27)  评论(0编辑  收藏