mitchellsimoens / Ext.ux.touch.grid

Grid components for Sencha Touch 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sorter feature persists and inverts direction from one column to another

adrianbadea opened this issue · comments

The sorting direction should be persisted and inverted for the same column. To reproduce, tap one column and then another and you will see how the sorting direction gets inverted from one to another.

Bellow is a fix proposal: in Sorter class, function handleHeaderTap, replace next line:

        dir       = sorter ? sorter.getDirection() : 'ASC',

with:

        dir       = (sorter && (sorter.getProperty() === dataIndex)) ? sorter.getDirection() : 'DESC',

Also, when taping for the first time on a column, the user expects as the sorting to ascending. So, since the sorting get inverted when store's sort function is called (see bellow), the default direction should be 'DESC:

    store.sort(dataIndex, dir === 'DESC' ? 'ASC' : 'DESC');

Thanks.

Why not submit a pull request?

Done. Thanks for the suggestion.

All the best,
Adrian.

On Sep 28, 2012, at 11:45 AM, Mitchell Simoens notifications@github.com wrote:

Why not submit a pull request?


Reply to this email directly or view it on GitHub.