sureshreddyk / jquery-datatables-row-grouping

Automatically exported from code.google.com/p/jquery-datatables-row-grouping
0 stars 0 forks source link

sorting of groups - feature request / documentation question #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Hi,

Great Plugin!

I was wondering if this functionality is already there and I'm just not 
understanding the documentation, but what I'm wanting is for the rows to be 
grouped by a single column, and for sorting to sort based on the "top" item in 
each group. For example: I would like to group by an order number, but when the 
user clicks the price header, I would like for the GROUPS to be reordered by 
price based on the first item in each order. For this I'm assuming that within 
the grouping, it should be ordered by the item number column (which is unique).

If this functionality is not yet there, would it be a feature that could be 
implemented easily?

Thanks,

Jared 

What is the expected output? What do you see instead?

--------------------------------------------------
--------------------------------------------------
|   items purchased     (pre-sort)               |
--------------------------------------------------
|   order_id, item_id, price, quantity, date     |
--------------------------------------------------
--------------------------------------------------
|   3, 16, $12.34, 3, 1/1/2012                   |
|   3, 19, $11.04, 3, 1/1/2012                   |
|   3, 31, $9.16, 3, 1/1/2012                    |
--------------------------------------------------
|   4, 16, $12.34, 3, 1/2/2012                   |
--------------------------------------------------
|   5, 47, $12.54, 3, 1/4/2012                   |
|   5, 51, $1.31, 3, 1/4/2012                    |
--------------------------------------------------
|   9, 31, $9.16, 3, 1/4/2012                    |
--------------------------------------------------
|   10, 13, $13.11, 3, 1/6/2012                  |
|   10, 15, $0.16, 3, 1/6/2012                   |
--------------------------------------------------
--------------------------------------------------

Becomes this:

--------------------------------------------------
--------------------------------------------------
|   items purchased     (post-sort, by item_id)  |
--------------------------------------------------
|   order_id, item_id, price, quantity, date     |
--------------------------------------------------
--------------------------------------------------
|   10, 13, $13.11, 3, 1/6/2012                  |
|   10, 15, $0.16, 3, 1/6/2012                   |
--------------------------------------------------
|   3, 16, $12.34, 3, 1/1/2012                   |
|   3, 19, $11.04, 3, 1/1/2012                   |
|   3, 31, $9.16, 3, 1/1/2012                    |
--------------------------------------------------
|   4, 16, $12.34, 3, 1/2/2012                   |
--------------------------------------------------
|   9, 31, $9.16, 3, 1/4/2012                    |
--------------------------------------------------
|   5, 47, $12.54, 3, 1/4/2012                   |
|   5, 51, $1.31, 3, 1/4/2012                    |
--------------------------------------------------
-------------------------------------------------- 

Instead, if I click a header to sort, it only sorts the items under a group's 
order and leaves the group ordering the same.

What version of the product are you using? On what operating system?
Latest version from:  
http://jquery-datatables-row-grouping.googlecode.com/svn/trunk/media/js/jquery.d
ataTables.rowGrouping.js
retrieved 4/25/2012 @ approx 3pm

Please provide any additional information below.

Thanks for the great work and I hope to hear from you soon.  Note:  I also 
added a comment (with the same information as this message) to your 
announcement of the plugin on the dataTable plugin's page.

Original issue reported on code.google.com by jnsohnumr@gmail.com on 26 Apr 2012 at 11:56

GoogleCodeExporter commented 8 years ago
Hi,

Unfortunately this is not possible. You can define sort order for the groups in 
the initialization call but it cannot be changed. 

I had to fix sort order because any later sorting pagination would break the 
groups. even in your case rows are a sorted a bit odd. you have (3,16), (3,31), 
(4, 16), (9, 31) therefore they are not ordered by order_id nor by item_id so 
it might look a little bit confusing to someone who expects entries to be 
sorted by some column. Even if I allow that kind of sorting I believe that I 
would get more complaint about the order that is shuffled.

Regards,
Jovan

Original comment by joc...@gmail.com on 13 Jul 2012 at 3:38

GoogleCodeExporter commented 8 years ago

Original comment by joc...@gmail.com on 23 Jul 2012 at 4:52