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
205
Get Column Index When a Column is Moved
posted

How do I get the column index of the column that is being moved or has just moved?

Is this used?  ActualColumnsChanged

There is almost no documentation on many of these events and methods.

Parents
No Data
Reply
  • 28945
    Offline posted

    Hello Matthew, 

    Thank you for contacting Infragistics. At this time there is no exposed index property on the columns. You have to keep track of the ActualColumns collection on the grid and compare the initial columns order with the new one obtained from the event and its event arg e.Columns. To answer your initial question ActualColumnsChanged event works as intended.

    Note our Blazor API was made public this week

    www.infragistics.com/.../

    eg.

    private List<Employee> Data;
    private IgbDataGrid _grid;
    private IgbDataGrid DataGridRef
    {
    get { return _grid; }
    set { _grid = value; this.OnDataGridRef(); StateHasChanged(); }
    }

    private ColumnMovingMode GridColumnMovingMode = ColumnMovingMode.Deferred;
    private ColumnMovingAnimationMode GridColumnMovingAnimationMode = ColumnMovingAnimationMode.SlideOver;
    private int GridColumnMovingSeparatorWidth = 1;
    public IgbGridColumnCollection gridColumns;

    protected override void OnInitialized()
    {
    base.OnInitialized();
    IgbDataGridModule.Register(IgniteUIBlazor);

    this.Data = EmployeeData.Create(100, false);
    }
    private void OnDataGridRef()
    {}

    protected override void OnAfterRender(bool firstRender)
    {
    base.OnAfterRender(firstRender);
    //Initial columns order
    gridColumns = this._grid.ActualColumns;

    }

    private void OnActualColumnsChanged(IgbGridColumnsChangedEventArgs e)
    {
    var columns = ((IgbDataGrid)e.Parent).ActualColumns;
    for (var i = 0; i < gridColumns.Count; i++)
    {
    //Output Initial columns order

    Console.WriteLine(gridColumns[i]);
    }

    //Columns moved order
    for (var i = 0; i < e.Columns.Count; i++)
    {
    Console.WriteLine(e.Columns[i]);
    }
    }

    You can suggest new product ideas for future versions (or vote for existing ones) at <www.infragistics.com/.../ideas>.
    Submitting your idea will allow you to communicate directly with our product management team, track the progress of your idea at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
    Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it.

    Let me know if you have any questions.

Children
No Data