Yii Framework Forum: Group By in Gridview - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Group By in Gridview Rate Topic: -----

#1 User is offline   Pierre M 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 28-August 14
  • Location:Belgium

Posted 01 December 2014 - 09:25 AM

Yii2ers,

I would like to show a single gridview with several 'sections'.
If your store sells apples, pears, and cherries, I'd like to get a single gridview with a top heading, and let's say 'subheadings' for my fruits.
Sell lines would come under those subheadings:

amount | unit price | total <-- Top heading
Apples <-- Sub heading
2 2 4
1 2 2
Total Apple: 6 <-- Ideal sub total
Cherries <-- Sub heading
2 1 2
3 1 3
Total Apple: 5 <-- Ideal sub total
Grand Total: 11 <-- Totals


Any idea on how to do it with gridviews?

I currently have 4 gridviews (Kartik's), one per fruit with their subtotal, and an additional gridview with subtotals and grand totals (collected with a sql group by sequence).

Would there be a more elegant way to achieve this?

Thank you.

/p
Don't force it. Use a bigger hammer. -- Unix fortune(1)
0

#2 User is offline   oligalma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 419
  • Joined: 07-April 12
  • Location:Spain

Posted 19 December 2014 - 09:19 PM

http://www.yiiframew...p?/topic/16709-
http://www.yiiframew...pan-subheaders/
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users