Sort callback function for custom sort

Posted by: tkarthik.006 on 10 April 2018, 6:11 pm EST

    • Post Options:
    • Link

    Posted 10 April 2018, 6:11 pm EST

    There is a converter option in sorting in GC.Spread.Views.Plugins.GridLayout.

    It doesn’t provide much information rather than the data of a single cell in a single column.

    How can I use it to create a custom sort function ?

    Thanks.

  • Posted 10 April 2018, 9:55 pm EST

    Hello,

    To sort a column with Spread.Views you can use the code as follows:

    
    ataView.options.sorting = {
                        field: 'country',   // name of column
                        ascending: true
                    };
    
    

    Thanks,

    Deepak Sharma

  • Posted 11 April 2018, 12:07 am EST

    The custom sort function should perform a group sorting. When sort is applied to one column, it should sort within the group, the group is formed based on other column.

    Column1 Column2

    1 1

    1 2

    1 3

    2 1

    2 2

    Here the values in column1 forms a group. Here there are two groups the records with value 1 and value 2. When sort is applied to column2, the sort should not scramble the group of records with value 1 rather it should sort within the groups formed by column1.

  • Posted 11 April 2018, 12:16 am EST

  • Posted 12 April 2018, 1:17 am EST

    Hello Karthik,

    This looks like a default design behavior. Since the grouping is applied on Column1 when Column1 is sorted it will sort all the values in Column1. It means on ascending it will 1 and 2, on descending it will show 2, 1 rows respectively.

    Thanks,

    Deepak Sharma

  • Posted 17 April 2018, 2:27 pm EST

    Hi,

    I still didn’t get my answer.

    For example,

    Before sorting :

    Column1 Column2

    1--------------------1

    1--------------------2

    1--------------------3

    2--------------------1

    2--------------------2

    When a sort is applied on column1, it behaves accordingly. But when a sort is applied on column 2 in this particular case, it should get sorted into something like this :

    Column1 Column2

    2--------------------2

    2--------------------1

    1--------------------3

    1--------------------2

    1--------------------1

    If you observe in the above output, in column1 the group of rows which has the value “1” and the group of rows that has the value “2” is still a group. But the sort happened inside that group of rows whose column1 values are “1” and “2”.

    Thanks

  • Posted 19 April 2018, 2:29 am EST

    Hello,

    Could you please provide me a sample application to demonstrate your issue or video file?

    You can use the demo online here:

    https://www.grapecity.com/en/demos/spread/JS/ViewsDemo/#/demos/GroupDragDropPanel

    Thanks,

    Deepak Sharma

Need extra support?

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

Learn More

Forum Channels