Inconsistency while sorting a grouped treelist

edited January 2016 in Technical questions

Code snippet: http://webix.com/snippet/5fa30b5c

Press the Group button then try to sort the Year and Film Title columns.

If you try to sort a column with sort:'int' (Year), it sorts properly. However, if you sort a column with a sort:'string' (Film title) the group footer/row goes to the top of the group instead of keep at the bottom, which it does in the sort:'int'.

Edit: also noticed that if I keep sorting the Film Title column, it will always show a different sort order every time I press it.

This also happens for custom sorts.

Is this working as intended or is it a bug? If so, is there any fix at the moment?

Tagged:

Comments

  • edited February 2016

    Technically, It does not seem like a bug. First, the treetable is sorted by the grouped value, year. You can check it with all the nodes closed. Then data is sorted within each group in the ascending and descending order with footer row being included into the sorting process.

    If you'd like to apply custom logic, you can use a custom sorting function.

  • While, the above behavior is not a real bug ( as group-footer is a just another row, not a special entity, so it sorts as other rows ), it really looks strage for end users.

    We will check how it can be improved, I think we will add an option to exclude some rows from the sorting ( it will be applied to group-footers automatically )

  • If I might make a suggestion, the added row with the totals should always be at the bottom of it's parent group. At least that is the behaviour me and my test users expected.

  • Is there any update on this "bug"?

    I am encountering this problem as well with a group grid with a footer that contains group totals/summary.

    A "footer", by definition, should always be at the bottom.

    A custom sorting function cannot solve the problem because a sorting function takes only to parameters: the 2 values being compared. You cannot tell whether the value being compared is part of a footer item. Also, you cannot tell whether the 2 values are being sorted in ascending or descending order. Because of this, Helga's suggestion above does not help.

    $footer items should really be excluded from the sorting and always be at the bottom of the group as maksim acknowledged.
    webix.DataStore.prototype.sort() already has this behavior for $freeze items - they always stay on top.
    Can the same be done for $footer items?

  • edited February 6

    Hello Webix Team!
    We are currently evaluating Webix, and are running into the same issue, where the footer appears at the top of the group instead of at the bottom of the group.
    Is there any way to make the footer appear at the bottom when sorting? Do you know when a fix will be available?
    Thanks,
    Alexis

  • edited February 10

    Hello @alexis,

    Is there any way to make the footer appear at the bottom when sorting? Do you know when a fix will be available?

    As previously mentioned in this thread, a custom sorting function can be applied, implementing your own logic. For instance, it is possible to ignore the footer items when sorting a table. Please take a look at the following example (note the custom sorting function in the "title" column): https://snippet.webix.com/zsysjf25.

Sign In or Register to comment.