Mess in the multi header after column move

Posted by: mariva on 8 September 2017, 3:18 pm EST

  • Posted 8 September 2017, 3:18 pm EST

    I have a spread with ColumnHeaderRowCount = 2. When I try to move any column, I get a mess in the header.
    Here is my code:

    fpSpread1.AllowColumnMove = true;

    DataTable table = new DataTable("name");
    table.Columns.Add("col1");
    table.Columns.Add("col2");
    table.Columns.Add("col3");
    table.Columns.Add("col4");
    table.Columns.Add("col5");
    table.Columns.Add("col6");
    table.Columns.Add("col7");
    table.Columns.Add("col8");
    table.Columns.Add("col9");
    table.Columns.Add("col10");

    for (int i = 0; i < 10; i++)
    {
    table.Rows.Add(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    }

    DataSet set = new DataSet("myset");
    set.Tables.Add(table);
    fpSpread1.Sheets[0].DataSource = set;

    But it doesn't happen if I don't use DataSource. How can I solve it?
    2015/07/test_header.zip
  • Replied 8 September 2017, 3:18 pm EST

    Hi!
    Any news how to fix it?
  • Replied 8 September 2017, 3:18 pm EST

    Hello,

    Column moving operates differently when in bound mode.

    When not bound and drag-moving a column, ColumnDragMove fires with MoveContent = true, and the effect is like inserting a new column at the target, then copying the contents of the source column to the target column, then removing the original source column.

    When bound and drag-moving a column, ColumnDragMove fires with MoveContent = false, and the effect is like that of SortColumns when used on a column range -- the SheetView column index mapping to model columns is changed so that the column appears moved in the view, but the actual columns in the data model are not affected (this is more efficient when using data binding).

    When there is an index mapping for columns or rows in the sheet view, then merged cells created with spans are disabled (not drawn) in case some cells are inadventently overlapped that were not before.

    To get the desired behavior, the customer just needs to add code in ColumnDragMove to set e.MoveContent = true and force the first type of moving action to happen instead of the second.

    Hope it clarifies.

    Thanks,
    Reeva
  • Replied 8 September 2017, 3:18 pm EST

    Hello,

    I could replicate the behavior mentioned by you and hence I am escalating the issue to the concerned team (tracking id :124280).

    I will get back to you as soon I hear anything from them.

    Regards,
    Mohita
  • Replied 8 September 2017, 3:18 pm EST

    Thank you! It works!
  • Replied 8 September 2017, 3:18 pm EST

    Oh, so that means it will affect the data source. Is there any way to show data correctly and to use multi header at the same time?
  • Replied 8 September 2017, 3:18 pm EST

    Hello,

    I have forwarded the query for confirmation from the concerned team.
    I will get back to you as soon I hear anything from them.

    Regards,
    Mohita
Need extra support?

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

Learn More

Forum Channels