nextras / datagrid

Nextras Datagrid component for Nette Framework.
http://nextras.org/datagrid
MIT License
70 stars 39 forks source link

DESC sort #37

Closed aleswita closed 7 years ago

aleswita commented 10 years ago

If you have default sort in column by DESC, like below

$grid->addColumn("revision","Revize")->enableSort($grid::ORDER_DESC);

data in grid table sorted are OK, but link for change sort from DESC to ASC is without function

hrach commented 10 years ago

what is without function? there is cycle asc -> desc -> null -> asc -> desc -> ...

aleswita commented 10 years ago

If I use code bellow

$grid->addColumn("revision","Revize")->enableSort();

cycle is: null -> asc -> desc ....

if use code below

$grid->addColumn("revision","Revize")->enableSort($grid::ORDER_ASC);

cycle is: asc -> desc -> asc -> desc ....

and if use:

$grid->addColumn("revision","Revize")->enableSort($grid::ORDER_DESC);

cycle is: desc -> desc -> desc

hrach commented 10 years ago

Thanks for bugreport, I will look into it.

vakvas commented 8 years ago

Hi, please.. is this behavior solved? Thanks a lot !

markfrydrych commented 8 years ago

Just looked into it and it seems that there is something wrong when creating link to sort signal. This is probably side effect of another bug.

Let's have an example scenario:

  1. Column 1 sorted DESC
  2. Click on column 2 heading
  3. Sorted column is column 2 (this is ok), but sorting status is set to NULL

This does not make sense to me. Column 2 should be sorted ASC everytime we change sorting to this column from some other column.

I will try to look into it in few days, I think that fixing this behaviour could also fix this bug.

hrach commented 7 years ago

Guys, are you able to do a pullrequest?

janmottl commented 7 years ago

I'm not familiar with code enough to be able to fix it. I suppose that problem is that it's not distinguished between first rendering and rendering after users change of sorting. It's necessary to detect user change of ordering and suppress default ordering.

hrach commented 7 years ago

So, it's fixed!

janmottl commented 7 years ago

Thanks. špica :)