View Full Version : Return on the good page with GridPanel - pagingToolBar

20 May 2010, 11:42 PM

Sorry my englih is not very good.

I use Ext.js with a house framework PHP based on Zend Framework.

The CRUD process is managed in the same window of the browser ( no pop-up).

For example, I show a list of customers in a GridPanel with pagination. I go to the page 5, I edit the form of my customer to modify him, then I subject the form for recording in the database.
Then I return on my customers list, but on the page 1. Would there be a means to return on the page 5?

In the html, the concerned field is called to x-tbar-page-number.

Thank you in advance for your returns :)

21 May 2010, 1:16 AM
Well, I a little advanced in my searches.
I had an autoLoad at true, but we can give it an object with attributes start and limit like that :

autoLoad: {params:{start: 28, limit: 14}}By making it I show the page 3, I do not have more than to return it dynamics so that my affair works. Highly-rated server I send back these parameters in the JSON, on the other hand, I do not too much know how to get back them in the file js to show them dynamically. Anybody would have an idea?
Thank you
Code from server

$params = new stdClass();
//Nombre de lignes à ommettre
$params->start = $this->_request->getParam('start', 0);
//nombre de lignes désirées
$params->limit = $this->_request->getParam('limit', 14);
$params->sort = $this->_request->getParam('sort', 'cli_name');
$params->dir = $this->_request->getParam('dir', 'DESC');

$r = new StdClass();
$r->results = $this->context->countGlobalQuery;
$r->rows = $datas;
$r->params = $params;
header('Content-Type: application/json; charset=UTF-8');
echo utf8_encode(ereg_replace('"__className":"[^\"]+",', '',Zend_Json_Encoder::encode($r)));Code from js page

// create the data store
var dataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: Ext.app.baseUrl + '/consultclients/getSearchDatas'
// create reader that reads the Topic records
reader: new Ext.data.JsonReader({
totalProperty: "results",.
root: "rows",
fields: [
//definition des champs
{name: 'cli_id'},
{name: 'cli_name'},
{name: 'cli_adresse'},
{name: 'ca'},
{name: 'tic'},
{name: 'cli_rdv_dt'}

//autoLoad: true,
autoLoad: {params:{start: 28, limit: 14}},

// turn on remote sorting
remoteSort: true