Possible to "pin" row at top of spread so that it's not affected by autosort?

Posted by: jonasp on 8 September 2017, 2:44 pm EST

  • Posted 8 September 2017, 2:44 pm EST

    I have a row which is "frozen" at the top of the spread and I still want to allow the user to sort the spread via the headers.

    Of course this means that when the user sorts the spread, the frozen row which should always stay at the top (it's purpose is some general input), will be sorted into another place in the spread.

    Is there any "special" way to achieve this, or does it mean I have to do a custom sort routine which makes sure this row always end up before the others?

    Also, autosort splits spanned cells but I suppose I could always re-span then after the sort. 

  • Replied 8 September 2017, 2:44 pm EST

    I'll answer my own question:

    protected override void OnAutoSortingColumn(AutoSortingColumnEventArgs e)

    {
        e.SortFrozenRows = false;
    }

    It still feels a bit off that the spanned cells are automatically splitted when sorting a column. Is there a way around or do I have to, manually, on OnAutoSortedColumn check if I have to restore those cells that should be spanned?

  • Replied 8 September 2017, 2:44 pm EST

    Hello,

    This is the intended behavior as once the rows are sorted, spans make no sense, after sorting the row which is included in a span may be moved  to a different position depending on its value and hence cannot be spanned. The same is even discussed under the following forum post:

                                              http://www.clubfarpoint.com/Forums/forums/thread/97157.aspx

    The only way to prevent spanned cells from being sorted is to use the SortRange method to sort the rows, and specify the range which you want to be sorted, excluding the spanned cels from the range and hence sorting would not affect the spanned cells.

    Thanks,

    Manpreet Kaur.

Need extra support?

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

Learn More

Forum Channels