2

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.

Mr-DC
  • 799
  • 5
  • 14
  • 25

2 Answers2

6

newp : 1 is the trick here.

$('#MyFlex')
    .flexOptions({
        url: urlAction,
        newp: 1
    }).flexReload();
Pang
  • 9,564
  • 146
  • 81
  • 122
ajay swamy
  • 271
  • 1
  • 5
  • Hi Ajay. I have another small question in regards to Flexigrid. Do you know if there is a way to disable the dragging and rearranging of the tables columns?? Many thanks, Dave. – Mr-DC Apr 16 '12 at 23:36
1

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();
GillesC
  • 10,647
  • 3
  • 40
  • 55