1. #1
    Ext User
    Join Date
    May 2010
    Posts
    21
    Vote Rating
    0
    akumariiit is on a distinguished road

      0  

    Default Working With Grouping view

    Working With Grouping view


    Hi
    I have a Grouping view which shows data in Gui like this

    -Group1 3 Items
    Item1 Count 3
    Item2 Count 4
    Item3 Count 2

    -Group2 2 Items
    Item1 Count 2
    Item2 Count 5

    Now i want to modify this text "3 Items" and "2 Items" after Group name and make it Total count of all the items.
    like

    -Group1 9 (3+4+2)
    Item1 Count 3
    Item2 Count 4
    Item3 Count 2

    -Group2 7 (2+5)
    Item1 Count 2
    Item2 Count 5


    can you pls provide some sample code or link whr i can find some help

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    82
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You could try:
    Code:
    groupTextTpl: '{text} ' +
      '<tpl exec="this.sum = 0"></tpl>' +
      '<tpl for="values.rs"><tpl exec="this.sum += values.data.count"></tpl></tpl>',
      '{[this.sum]} ' +
      '(<tpl for="values.rs"><tpl if="xindex &gt; 1">+</tpl>{values.data.count}></tpl>)'
    (have a look at the XTemplate API docs for details)

    Disclaimer: Completely untested code!

  3. #3
    Ext User
    Join Date
    Mar 2008
    Posts
    3
    Vote Rating
    0
    wanderArounder is on a distinguished road

      0  

    Default


    I was having some similar issues.
    In 3.3, I got was able to get to the grouped records this way:

    Code:
    groupTextTpl: '<tpl for="values.rs">{values.data.start_date}</tpl>'                                      '
    Where start_date is a item in my records.
    In addition I added
    Code:
    <tpl if="xindex &lt; 2">
    so that I only get the start date for the first record, as I didn't need them all.
    The API incorrectly states that "rs" contains only one row's worth of data, when in fact it contains all rows that are in the group.

    For what its worth, the documentation for groupTextTpl could use some updated information about what values are available, and how to get to them. I like XTemplates, but they are tough to debug (unlike most other things in Ext), and each use of XTemplate is different... Extensive, accurate info is essential.

Similar Threads

  1. Grid buffered view and grouping view ?
    By lucky56100 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 19 Jul 2010, 1:14 AM
  2. Grouping View Quirkyness
    By madirishman in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 1 Feb 2010, 12:35 PM
  3. Grouping view question
    By mankz in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 19 Oct 2009, 4:09 AM
  4. [2.1] Grouping View: groupRenderer
    By jaxl in forum Ext 2.x: Bugs
    Replies: 2
    Last Post: 16 Jan 2009, 12:43 PM
  5. Grouping view and summary
    By timur-kar in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 4 May 2008, 11:43 PM

Thread Participants: 2

Tags for this Thread