Change grid column index in OnStateInit not working

1 Answer 36 Views
Grid
Claudio
Top achievements
Rank 2
Bronze
Bronze
Iron
Claudio asked on 13 Dec 2024, 01:24 PM

Hi, my code use OnStateInit to change the column order, settings the GridColumnState.Index property.

Now i found it not work anymore (i can't found the cause).

This is a simplified version who reply the issue: grid is created with Col1 and Col2, in OnStateInit i revert the index of the columns so i assume who grid will render with Col2 and Col1 (inverted order) but seem not working.

https://blazorrepl.telerik.com/QeFwbnFd19xPAId547

 

What's wrong?

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 13 Dec 2024, 02:18 PM

Hi Claudio,

The OnStateInit handler should also take into account the checkbox column:

    private void OnGridStateInit(GridStateEventArgs<GridData> args)
    {
        args.GridState.ColumnStates = new List<GridColumnState>
        {
            new GridColumnState() { Index = 0 },
            new GridColumnState() { Index = 2 },
            new GridColumnState() { Index = 1 }
        };
    }

 

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Claudio
Top achievements
Rank 2
Bronze
Bronze
Iron
Answers by
Dimo
Telerik team
Share this question
or