Ordering inside Row Group without changing Group order.

Ordering inside Row Group without changing Group order.

fco_1990fco_1990 Posts: 9Questions: 3Answers: 0

Link to test case:
live.datatables.net/ruxakoga/5/edit

Description of the current Datatable:
I have that live demo running okay. As you can see there are multiple Row Groups (ie: Receiving, Raw Deep Lane, Storage, and so on).

Row Groups must always stay ordered the way they are now. I mean... order must be:
1. RECEIVING
2. RAW_DEEP_LANE
3. STORAGE
4. FINISHING
5. WRAPPER
6. LAMINATOR
7. PRESS_7
8. PRESS_8
9. SHX1
10. WIP
11. PR_CHARGING

Description of problem:
I want to be able to Order By "AGV Tasks" column inside the Row Groups but without changing Row Group order itself.

So, in images this would be seen something like this.

I tried for several hours to achieve that without luck. I've done tons of research but I don't see how...

Any advice is welcome.

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    I would look at using Orthogonal Data for the sorting of the dataSrc: 'area', column. I would create a global variable that contains and object that denotes the order of the Row Group. Then use order to order by that column followed by the AVG Tasks column. Here is my example:
    http://live.datatables.net/ruxakoga/6/edit

    Note that in the object I used letters instead of numbers for the Row Group order. Its due to Datatables type detection and that column is typed as a string. You could use "01", "02", etc instead to sort the strings by a numeric representation if you wish.

    Kevin

  • fco_1990fco_1990 Posts: 9Questions: 3Answers: 0

    Kevin. Your live example is by default already ordered 'asc' on AGV Task.

    I would like to keep it the way is given on the dictionary data when loaded first time and if you hit AGV Task header then order it asc/desc by that field.

    Anyways hitting that AGV Tasks header does nothing on your live demo. Why?

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769
    Answer ✓

    Anyways hitting that AGV Tasks header does nothing on your live demo. Why?

    You have this config:

                {
                    "data": "agv_tasks",
                    "orderable": false
                },
    

    This turns of the user's ability to order the columns. I commented it out and used oderFixed for column 0. Now you can sort the AGV Tasks column and keep the order of the RowGroup.
    http://live.datatables.net/ruxakoga/7/edit

    Kevin

  • fco_1990fco_1990 Posts: 9Questions: 3Answers: 0

    Excellent Kevin. It works like a charm.

    The only thing I'm struggling now is that when I click on "AGV Tasks" column it orders ASC first. I've to click again so it's order DESC.

    I'd like to invert it so when I click first time it order DESC and if I click again it orders ASC. Is that possible? It's like inverting from 'asc' 'desc' to 'desc' 'asc'.

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769
    Answer ✓

    I think you can control that using columns.orderSequence.

    Kevin

This discussion has been closed.