JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Data Grid Is it possible to set the sort index programmatically? (Blazor)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #102494
    TurricanDE
    Participant

    I want to set the sort indexes of columns programmatically, but I could not found a property something like “SortIndex”

    In the GridColumn properties I could only found “SortOrder”. Is there a way to achieve that?

    Thanks in advance.

     

     

     

     

    #102499
    admin
    Keymaster

    Hi,

    The Grid’s SortBy method can be used to apply sorting to a column using the Grid API. SortIndex Column property is not  available.

    Best regards,
    Peter Stoev

    Smart UI Team
    https://www.htmlelements.com/

    #102502
    TurricanDE
    Participant

    I could’t find a method “SortBy” (we are in Blazor)?

    I could use an event callback “Sort” e.g.

    private async Task Sort(Event ev)
    {
    GridSortEventDetail sortEventDetail = ev[“Detail”];

    var sortIndex = sortEventDetail.Columns[0][“sortIndex”];

    }

    But the sortIndex is always “0”, but I know it must be somewhere, how does the grid know the sort index (sort indexes are shown in the columns 😉

    The problem is when the user does a multiple sort and I want to save these settings there is no way to set the sort indexes correctly again.

    For example we have three columns

    ID [SortOrder DESC, SortIndex = 2] Name [SortOrder ASC, SortIndex = 1] Address [SortOrder ASC, SortIndex =3]

    I want to set the colums array programmatically when the user chooses a specific setting. I can reproduce all sort orders for the columns but not the sort indexes

    GridColumn newColumn = new GridColumn()
    {
    Label = …..,
    SortOrder = GridColumnSortOrder.Asc,
    SortIndex = …. <= I need this

    }….

     

    #102503
    admin
    Keymaster

    Hi,

    The grid internally has a sort index, but there is no public API to retrieve it. This is something which we will add in the next version of the Blazor Grid as well as the missing SortBy method for it.

    Best regards,
    Peter Stoev

    Smart UI Team
    https://www.htmlelements.com/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.