You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Boris Brinza <bo...@htsolution.sk> on 2013/08/27 23:47:56 UTC

how to switch off sort?

Hello
is it possible to switch off sort, when i use OrderByBorder on DataView?
Or, better say, I'd like to change sort to 3-state behavior : asc, desc, off

Thanks in advance
Boris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: how to switch off sort?

Posted by Boris Brinza <bo...@htsolution.sk>.
Hello,
maybe i've describe problem wrong, my effort leads to  3-state 
orderbyborder link.
off->asc->desc->off etc.

I've extended my data provider from SortableDataProvider and i try to 
override getSort() method to achieve 3state.
It seems to work except icon shown in table header. Even i return null 
from getSort() after click on desc ordered data , icon in header is 
switched again to asc (arrow up).

Maybe code will say more:

     private enum SortState {OFF, ASC, DESC}
     private SortState currentState = SortState.OFF;
     @Override
     public SortParam<String> getSort() {
         SortParam<String> sortParam = super.getSort();
         if (sortParam == null) {
             return null;
         }


         switch (currentState) {
             case OFF:
                 currentState = SortState.ASC;
                 break;
             case ASC:
                 currentState = SortState.DESC;
                 break;
             case DESC:
                 currentState = SortState.OFF;
                 break;
         }

         return currentState == SortState.OFF ?
                 null : new SortParam<String>(sortParam.getProperty(), 
currentState == SortState.ASC ? true : false);

     }




On 08/27/2013 11:59 PM, Paul Bors wrote:
> What happens when you give it a null sortProperty?
>
> ~ Thank you,
>    Paul Bors
>
> -----Original Message-----
> From: Boris Brinza [mailto:boris.brinza@htsolution.sk]
> Sent: Tuesday, August 27, 2013 5:48 PM
> To: users@wicket.apache.org
> Subject: how to switch off sort?
>
> Hello
> is it possible to switch off sort, when i use OrderByBorder on DataView?
> Or, better say, I'd like to change sort to 3-state behavior : asc, desc, off
>
> Thanks in advance
> Boris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


-- 

S pozdravom

Boris Brinza
HT Solution s.r.o.
Digital Park II
Einsteinova 25
851 01 Bratislava
Slovakia

Phone: +421 2 3500 2512,  Mobile: +421 903 602 126
E-mail: boris.brinza@htsolution.sk | www.htsolution.sk


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: how to switch off sort?

Posted by Paul Bors <pa...@bors.ws>.
What happens when you give it a null sortProperty?

~ Thank you,
  Paul Bors

-----Original Message-----
From: Boris Brinza [mailto:boris.brinza@htsolution.sk] 
Sent: Tuesday, August 27, 2013 5:48 PM
To: users@wicket.apache.org
Subject: how to switch off sort?

Hello
is it possible to switch off sort, when i use OrderByBorder on DataView?
Or, better say, I'd like to change sort to 3-state behavior : asc, desc, off

Thanks in advance
Boris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org