PDA

View Full Version : I need Help



8 Feb 2013, 3:09 AM
I've a grid with pagination and order by data desc, when i insert a record in this grid with a window (it's not a editor grid panel), how set the grid on the page of the last insert record ??
This is possible ??

sword-it
10 Feb 2013, 11:22 PM
Hi,

May be you can provide more info about your need ,for better understanding the problem
as i understood your problem, try following code for insert record into grid ,after click on save button of your window:



var record = new (yourGrid.store.recordType)(formvalues);
yourGrid.store.insert(0, record);

11 Feb 2013, 12:43 AM
I don't insert in the store, i insert directly in db ..........

sword-it
11 Feb 2013, 1:47 AM
Hi,

could you explain exactly what you want or provide your code ,

willigogs
11 Feb 2013, 7:12 AM
If I understand what is being requested, then you would need to do the following:

You add a new record to the DB
In your server success response, you will have to do some backend logic to check WHERE this has been inserted according to your sorting method - then return this. E.g. if it was a database of people, and you just added "Peter Parker", you would then return something like "success: true, recordnumber: 577".
You then divide this returned number by your paging amount to know what page it would be listed on.
Use the pagingbar's changePage() method to load the correct page of results where this record has just been added to
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.PagingToolbar-method-changePage