Extjs最后一页数据删除之后自动返回上一页

var st =grid.getStore();

var totalCount = st.getTotalCount(); // 所有的记录数,不单单是当前页展示的数据
var pageSize = st.pageSize; // 一页上面展示的记录条数
var curPage = st.currentPage; // 当前页码
var fromRecord = ((curPage - 1) * pageSize) + 1; // 当前页展示的起始记录号
var toRecord = Math.min(curPage * pageSize, totalCount); // 当前页展示的结尾记录号
var totalOnCurPage = toRecord - fromRecord + 1; // 当前页展示的记录条数
var totalPageCount = Math.ceil(totalCount / pageSize); // 总的页数
//若当前页是最后一页,且不是仅有的一页,且删除的记录数是当前页上的所有记录数
if (curPage === totalPageCount && totalPageCount != 1)
{
st.currentPage--;
}

st.load();

原文地址:https://www.cnblogs.com/bigcelestial/p/3437780.html