Get ready for BLACK FRIDAY shopping starting in

HTML5 Data Bindings Formatter Support Product Page

Under investigation

Group By 'bug' when group contains one item?

Reported 31 Oct 2016 09:26:21
1
has this problem
31 Oct 2016 09:26:21 Hans Haverlach posted:
Hi I have a group by filter applied. Code:


 <div class="row" data-binding-repeat="{{ex_stap4init.data.q_gpdata.groupBy( &quot;gdp_date&quot; )}}" data-binding-id="repeat2">
            	<h6 class=" columns" style="margin-bottom:0px; padding-bottom:0px;"><strong>{{ex_stap4init.data.q_gpdata[$index].gdp_datelang.capitalize()}} </strong></h6>
            
            	<div class="small-12 columns" data-binding-id="repeat3" data-binding-repeat-children="{{$value}}" > 
                <span class="groepsnamen float-left">{{g_vrnaam}},&nbsp;</span>
                </div><br><br><br>
            	
        </div> 


The last group contains only one item. What happens is that the last group title(H6) gives the same value as group 1 (index 0). As soon as I add an extra item in the database, so the last group contains 2 items, the H6 title of the last group is correct.

Is this a bug? Or do I do something wrong? I like to hear from you soon if possible,working on a deadline.
Thank you!

Replies

Replied 31 Oct 2016 09:59:25
31 Oct 2016 09:59:25 Teodor Kuduschiev replied:
The code you are using for h6 has nothing to do with the groupby filter / nor it is shown in the tutorial.
Anyway - I just tested this locally and i cannot reproduce such an issue. Everything displays fine.
Replied 31 Oct 2016 10:54:19
31 Oct 2016 10:54:19 Hans Haverlach replied:
Hi Teodor,

You are correct. Using the {{$name}} value in the H6 code will produce the right title.
But I used my approach because another time I needed two values in the H6 title.
Since the group by filter/tutorial only shows the method to use the $name value from the repeat section, I thought I found a way to also show another value by using this 'smart' code:


{{ex_stap4init.data.q_gpdata[$index].gdp_datelang.capitalize()}} 


But it was probably not smart enough :-)). But is it possible to have more than one value in the main title? So in your tutorial you group by Country. Say that every country has an Country ID, to also show that Country ID next to the country name?


Anyway, thank you for your reply
Replied 31 Oct 2016 11:26:17
31 Oct 2016 11:26:17 Teodor Kuduschiev replied:
You can add another value from the data bindings tree in the inner repeat region.

Reply to this topic