PDA

View Full Version : GroupingView - Id generation problem



mwasiak
16 Jul 2012, 4:38 AM
Hi everyone,

I have problem with GroupingView, options set like this:


view: new Ext.grid.GroupingView({
forceFit: true,
showGroupName: false,
groupTextTpl: '-{gvalue}',
enableNoGroups: false,
enableGroupingMenu: true,
hideGroupedColumn: false
})

In my grid I have few groups, like Group1, Group2, Group3 and in each group I have same item eg. user1. But ExtJS generates same Ids for each group, while rendering grid. So in the end I can't minimize and maximize groups...

Part of generated HTML:


<div id="ext-gen280-gp-Name-Group1" class="x-grid-group ">
<div id="ext-gen280-gp-Name-Group1-hd" class="x-grid-group-hd" style="width: 972px;">


<div id="ext-gen280-gp-Name-Group1-bd" class="x-grid-group-body">


</div>


<div id="ext-gen280-gp-Name-Group1" class="x-grid-group ">

<div id="ext-gen280-gp-Name-Group1-hd" class="x-grid-group-hd" style="width: 972px;">
<div class="x-grid-group-title">-Group1</div>


</div>


<div id="ext-gen280-gp-Name-Group1-bd" class="x-grid-group-body">



</div>

So why there is Id 280 in each group? This problem occurs in every group that have same items, but why Ext not generate unique Ids anyway? How can I solve this problem, unfortunately values in my grid must be duplicated.

Thanks for any help.

scottmartin
17 Jul 2012, 4:33 PM
What version of Ext3 are you using?

Each should have their own numeric value:



ext-gen13-gp-milestone-116008
ext-gen13-gp-milestone-116008-hd

ext-gen13-gp-milestone-116010
ext-gen13-gp-milestone-116010-hd


Scott.

mwasiak
17 Jul 2012, 11:11 PM
Thanks for reply Scott,

Im using Ext 3.4.0. I know that Id properties should have unique values, this is internal Ext mechanism, but in my HTML code generated by Ext (I render Grouping view) Ids values are duplicated and thats the point... I have no idea whats wrong in my JS code, I've searched Sencha Forum and others but nothing found...

I feel that I've missed sth. :s

scottmartin
18 Jul 2012, 6:10 AM
You will need to post a small working example so we can have a look.

Scott.

mwasiak
24 Jul 2012, 3:54 AM
Uff, I solved the problem! But I still don't know how is this possible that Ext print same <generated_id> values... ~o)

Ext 3.4.0 while rendering GroupingView elements(divs), generates id's like this:

ext-gen<generated_id>-gp-<grouping_column_name>-<grouping_column_value>

Problem is when you groups rows by column1, but render (groupRenderer) name from column2. So we get rendered divs with same ID (same grouping_column_name and grouping_column_value). To solve this problem I render groups by other hidden column, to eliminate duplicated groups. It's not pretty but it works ;)