Spread sheetview sorting

Posted by: arthi-prasad on 8 September 2017, 1:02 pm EST

  • Posted 8 September 2017, 1:02 pm EST

    Hi,


    I'm using far point spread sheet . Currently to sort the rows in the spread sheet i have written the following sortrows function.


    sheetView.SortRows(0, sheetView.Rows.Count, sortInfo)


    If i use this the sorting takes place as follows in Current scenario:


    When i try to sort a column in both ascending and descending order , all the special characters appears first followed by data with numbers, then with A...Z  followed by empty values in ascending order and vice versa in descending except empty values. The empty values appear at the end.


    But i need the sorting to take place as follows:


    If i sort a column in ascending order,empty values should come on top(The result should be displyed the same way as we get from the database thro query using sort by).


    Could you please suggest a solution for this?


    Thanks,


    Arthi

  • Replied 8 September 2017, 1:02 pm EST

    Arthi -

    What version are you using?  When I sort ascending the empty values are on top.  Make sure you have the latest maintenance release for the version you have.  Also, how are you defining the empty values?
  • Replied 8 September 2017, 1:02 pm EST

    Bob-


    Thanks for ur reply.


    The far point version i'm using is 2.5.


    The empty values are just empty string.


    Thanks,


    Arthi

  • Replied 8 September 2017, 1:02 pm EST

    Arthi,


    The results you are seeing with the Spread sorting is expected behavior. This has been the behavior of the Spread sorting (not to sort the blank cells) since the version 1 of Spread. If you want a different sort order, you would need to implement a new IComparer interface to pass in to the Sort method.

  • Replied 8 September 2017, 1:02 pm EST

    Hi Scott,


    Due you have any code sample on how to implement IComparer interface?


    Thanks, Arthi

  • Replied 8 September 2017, 1:02 pm EST

    Arthi -

    Have a look at the following posts...

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

    http://www.clubfarpoint.com/Forums/forums/thread/16753.aspx
Need extra support?

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

Learn More

Forum Channels