最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to reset Page to 1 using Flexigrid - Stack Overflow

programmeradmin2浏览0评论

I am currently using Flexigrid which is great. However when i am on say page 8 of a particular list of books then i change to another set of books which has less than 8 pages, the Flexigrid loads Page 8 with nothing on it...

I am just wondering how to reset the 'page' value to 1. I have tried:

$("#books").flexOptions({ url: '/books/list', params: [{ name:'bookId', value: $('#Books').val()}, {name:'fromDate', value: $('#fromDate').val()}, {name: 'toDate', value: $('#toDate').val()}]}).flexReload({ page: 1 }); 

and

$("#books").flexOptions({ page: 1, url: '/books/list', params: [{ name:'bookId', value: $('#Books').val()}, {name: 'fromDate', value: $('#fromDate').val()}, {name: 'toDate', value: $('#toDate').val()}]}).flexReload();

Any help is much appreciated.

I am currently using Flexigrid which is great. However when i am on say page 8 of a particular list of books then i change to another set of books which has less than 8 pages, the Flexigrid loads Page 8 with nothing on it...

I am just wondering how to reset the 'page' value to 1. I have tried:

$("#books").flexOptions({ url: '/books/list', params: [{ name:'bookId', value: $('#Books').val()}, {name:'fromDate', value: $('#fromDate').val()}, {name: 'toDate', value: $('#toDate').val()}]}).flexReload({ page: 1 }); 

and

$("#books").flexOptions({ page: 1, url: '/books/list', params: [{ name:'bookId', value: $('#Books').val()}, {name: 'fromDate', value: $('#fromDate').val()}, {name: 'toDate', value: $('#toDate').val()}]}).flexReload();

Any help is much appreciated.

Share Improve this question asked Apr 16, 2012 at 6:45 Mr-DCMr-DC 8695 gold badges15 silver badges29 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

newp : 1 is the trick here.

$('#MyFlex')
    .flexOptions({
        url: urlAction,
        newp: 1
    }).flexReload();

What you can do is simply locate the "First" button and trigger the click event on it. So let's say your table is contained into an div with an id of container (it's good to target a context if you have multiple tables grid)

$('#container .pFirst').click();
发布评论

评论列表(0)

  1. 暂无评论