C1List move column in code

Posted by: softcomlimited on 13 October 2020, 11:27 am EST

    • Post Options:
    • Link

    Posted 13 October 2020, 11:27 am EST

    Hello,

    How do you move a C1List column in code? AllowColMove = True lets the user do it interactively.

    I don’t want to change the columns in the datasource,

    FlexGrid has c1flx.cols().Move()

    Thanks

    Brian

  • Posted 13 October 2020, 5:20 pm EST

    Hi Brian,

    Yes, apart from enabling column move interactively by setting the AllowColMove property, you can also move column at runtime. For this, you can use the RemoveAt and Insert methods as follows:```

    var dispCol = C1List1.Splits[0].DisplayColumns[2];

    C1List1.Splits[0].DisplayColumns.RemoveAt(2);

    C1List1.Splits[0].DisplayColumns.Insert(0, dispCol);

    Ruchir
  • Posted 22 October 2020, 12:51 am EST

    Thank you very much Ruchir, I would not have thought of removing it at all.

    The final code to switch the columns…

    Dim dispCol = Me.c1lst.Splits(0).DisplayColumns("AmtOutstanding")
    Me.c1lst.Splits(0).DisplayColumns.RemoveAt(Me.c1lst.Splits(0).DisplayColumns.IndexOf(dispCol))
    Me.c1lst.Splits(0).DisplayColumns.Insert(Me.c1lst.Splits(0).DisplayColumns.IndexOf(Me.c1lst.Splits(0).DisplayColumns("Approved")), dispCol)
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels