Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3790
reorder my column keys after data load.
posted

Once my grid is complete and all data is loaded I'd like to rename all my column keys to be 0-column length. Since my data comes form a webApi its based on my variable names. And variables can not start with a number. Alternatively I'd like to be able to get my column index in the columnSorting event but the API does not expose this? So I have to do this to get it.

 for ( var c = 1; c < gridId.igGrid( "option", "columns" ).length; c++ )
                    {
                        if ( gridId.igGrid( "option", "columns" )[c].key == ui.columnKey ) colIndex = c;
                    }

That will not work since I really need my column to be the same name in some cases. So the best option I have then is to reorder my column keys at dataRendered.  Can this be done?

FYI: this is breaking the grid

                for ( var c = 1; c < gridId.igGrid( "option", "columns" ).length; c++ )
                {
                    gridId.igGrid( "option", "columns" )[c].key = c;
                }

Parents Reply Children
No Data