Y
Y
Yuri2012-07-03 16:36:54
ExtJS/Sencha
Yuri, 2012-07-03 16:36:54

How to implement sorting in Grid?

So that there is paging using the PagingToolbar and the values ​​​​are sorted by all data. Those. Here is a typical example of a grid implementation with paging:
dev.sencha.com/deploy/ext-4.0.0/examples/grid/pagi...
But if in the same example you go to the second page, then sorting by answers will no longer be the same as on the first page. And I need it through - according to all the data.
Is it really possible to do this? Can't google it... Thanks in advance.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
maovrn, 2012-07-03
@modestguy

In my opinion, in that example, everything is in order with sorting. The key property of the store is remoteSort: true, i.e. all sorting concerns are shifted to the back-end. You just need to catch the parameters that the paginator passes:

// параметры для пагинатора 
$defaults = array(
    'start' => 0,      // с какой строки начинать
    'limit' => 20,     // сколько строк на странице
    'sort'  => null,   // поле, по которому сортировать
    'dir'   => 'ASC'   // направление сортировки
);

$params = array();
foreach ($defaults as $key=>$value) {
    $params[$key] = $this->getRequest()->getParam($key, $value);
}

Then add them to your sql query.

K
Kite, 2012-07-03
@Kite

To make remote sorting probably? remoteSort was in the third version of ExtJs

Y
Yuri, 2012-07-04
@modestguy

Thanks to all. The option with remoteSort: true is what you need.

M
morello, 2012-07-03
@morello

If you look closely at this project , is it not suitable for your goals?

Y
Yuri, 2012-07-03
@modestguy

Thanks guys, I'll take a look tomorrow.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question