1. #1
    Ext User
    Join Date
    May 2008
    Posts
    58
    Vote Rating
    0
    pillindra is on a distinguished road

      0  

    Default changing the initial sort direction of a table column to DESC

    changing the initial sort direction of a table column to DESC


    When I click on one of the TableColumn that has sorting enabled (using Table/TableColumn API) but not sorted initially, the first sort is always ASC. Is there any option to change the first sort direction on clicking a column header to DESC when I click first time on the TableColumn header.

    Thanks,
    Padma

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

  3. #3
    Ext User
    Join Date
    May 2008
    Posts
    58
    Vote Rating
    0
    pillindra is on a distinguished road

      0  

    Default


    glsender,

    That worked for showing the sorting icons on the column header after the table is rendered initially which is very helpful from the usability point of view to know the sort direction. But, in case of using Table, clicking on any other column that is not part of Deferred command, first sorts the table by ASC.

    For Example, if I have 5 columns in a table. I sort the table by 3 rd column in ASC and show the sorting Icon after the table is rendered as shown below with the solution that you have provided in the previous thread

    DeferredCommand.addCommand(new Command() {
    public void execute() {
    tbl.getTableHeader().sort(2, SortDir.ASC);
    }
    });

    This part works fine.

    Then user clicks on column 1 of the table. Then, the column values are sorted by ASC first. Is there any way, to make this sorted by DESC first. To resolve this, I tried adding the following to the DeferredCommand which provided a work around for me. (sorting column 1 by ASC when table is rendered, so user click once again makes it DESC)

    DeferredCommand.addCommand(new Command() {
    public void execute() {
    tbl.getTableHeader().sort(0, SortDir.ASC);
    tbl.getTableHeader().sort(2, SortDir.ASC);
    }
    });

    But, when I switch clicking between sorting of different columns, every column remembers the last sort I have made. Basically this Sorting toggles rather than resetting after clicking another column. Is there any easiest way of resetting sorting of a column after clicking another column to the one mentioned in DeferredCommand.

    Thanks,
    Padma

  4. #4
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

    Default


    what about using Table.sort to set the default and Table.getHeader.setSort to change the default heading?

  5. #5
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

    Default


    I may have led you down the wrong path - I think this might be the solution....

    1) use Table.sort() in a deferred command to ensure it is rendered and it will do the getTableHeader().sort(index, sortDir) for you.

    2) extend TableColumn class and override the default protected SortDir sortDir = SortDir.NONE to be whatever you want the default to be for every column.

    That should work (I think )

  6. #6
    Ext User
    Join Date
    May 2008
    Posts
    58
    Vote Rating
    0
    pillindra is on a distinguished road

      0  

    Default


    gslender,

    The solution in item (1) does resolve the issue partially and thanks for your input. But I am still looking in to resolution for 'Sorting toggles rather than resets after clicking another column'.

    Thanks,
    Padma

  7. #7
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

    Default


    pillindra,

    Seems like Table kinda has bug (more of a usability issue than code) and I doubt it would be fixed considering Grid is where all the effort for the new table-like widget is going to be. I'm guessing it won't be long before a working gird with all the correct behaviour will be provided. The SVN has the fundamentals of a gird already working in test...

    My best advice (for a short-term fix) would be to study the workings of Table and extend and change the issue behaviour - I'd guess it wouldn't be that hard.

  8. #8
    Ext User
    Join Date
    May 2008
    Posts
    58
    Vote Rating
    0
    pillindra is on a distinguished road

      0  

    Default


    Thank you for your reply. That helps. I will look in to modifying it.

    Padma

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar