Results 1 to 6 of 6

Thread: grid column sorting "icon visibility"after initialization

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2008
    Posts
    15

    Default grid column sorting "icon visibility"after initialization

    Hi,

    I am trying to see which column in a grid is sorted directly after loading a store with

    sorters
    : {property:'id',direction:'ASC'}

    The store is loaded remotely and the data is sorted correctly, but I can not see the little "arrow icon" on my id column. Even if I use

    remoteSort: true

    on my store, I can not see, which column is already sorted.

    I can not find any setting on the column itself to archive this? Can someone help?

    Thanks
    Chris

  2. #2
    Sencha - Sustaining Engineer tristan.lee's Avatar
    Join Date
    Mar 2015
    Location
    Central Ohio
    Posts
    1,579
    Answers
    165

    Default

    I don't believe the indicator is present until you first click on the column to change the sort. However, you can always call store.getSorters() to see how it is sorted.
    Tristan Lee
    Sencha Inc - Sustaining Engineer


    Having an issue? Help us help you - be detailed; provide some code; demonstrate with a fiddle (fiddle.sencha.com)

    Embed your fiddle in your post: [FIDDLE]id[/FIDDLE]

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2008
    Posts
    15

    Default

    Hey Tristan,

    thanks for your fast answer.

    Can I make it possible somehow? I tried to call

    store.sorters.clear();
    store.sorters.add(new Ext.util.Sorter({
    property: 'id',
    direction: 'DESC'
    }));

    after onPainted on the grid, and the sorting of the records changes, but the indicator is still not visible. Can you give me an hint where (and how) I have to dig in?

    Thanks
    Chris

  4. #4
    Sencha - Sustaining Engineer tristan.lee's Avatar
    Join Date
    Mar 2015
    Location
    Central Ohio
    Posts
    1,579
    Answers
    165

    Default

    That just applies the sorter to the store and does not reflect the UI of the grid column header. The sort indicator only becomes visible once the user has actually clicked on the column to change sort direction.

    As far as I know, there's no out-of-the-box way to make the indicator show without user interaction.
    Tristan Lee
    Sencha Inc - Sustaining Engineer


    Having an issue? Help us help you - be detailed; provide some code; demonstrate with a fiddle (fiddle.sencha.com)

    Embed your fiddle in your post: [FIDDLE]id[/FIDDLE]

  5. #5
    Sencha Premium Member
    Join Date
    Jul 2008
    Posts
    15

    Default

    And can you point me to an "non-out-of-the-box" way?

  6. #6
    Sencha User
    Join Date
    Nov 2017
    Posts
    5

    Default

    You can do it if you save the ref for the grid. Once you have the ref, you can call this in a componentDidMount():

    this.grid._headerContainer.columns[0].toggleSortState();

    This will show the sort arrow on the first column

Similar Threads

  1. Replies: 4
    Last Post: 27 Jul 2018, 9:47 AM
  2. Replies: 1
    Last Post: 16 Nov 2012, 11:44 AM
  3. Replies: 2
    Last Post: 7 Jun 2012, 5:09 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •