PDA

View Full Version : How to Add Grouping in Grid



navdimri
30 Jun 2009, 4:39 AM
Hi All,


Can anyone tell me, how can I add grouping property on my gridPanel based on field names i.e column headers.

Please help me out, as I am new to this ext js world

Regards,
navdimri

BitPoet
30 Jun 2009, 5:24 AM
For that, you need to use a GroupingStore (http://extjs.com/deploy/dev/docs/?class=Ext.data.GroupingStore) instead of a normal store for your grid and add a GroupingView (http://extjs.com/deploy/dev/docs/?class=Ext.grid.GroupingView). The documentation for the GroupingView has a short example, and there is a functional one (http://extjs.com/deploy/dev/examples/grid/grouping.html) in the examples shipped with ExtJS.

navdimri
17 Aug 2009, 6:27 AM
Thanks BitPoet,

Actually I need to display multiple values for a single property, and not the grouping, which I mentioned earlier by mistake.

Please suggest me

Regards,
navdimri

Condor
17 Aug 2009, 6:41 AM
In that case you'll have to explain better, because I don't understand what you are asking...

navdimri
18 Aug 2009, 3:43 AM
First Of all , thanks Condor.

What I need: --> under column1 , data is coming from one DB table, under coulmn2 data is coming from another DB table and so on..

Both tables have same properties like empName, empAddr etc.. but in table 2 empName can have multiple values.

So Can you please suggest, how can I display all values of empName under the columns. Below is the format of the data, that I need to display.

PropertyName | Table1 | table2
empName | emp1 | emp1
| emp2 | ----
| emp3 | emp3
empClass | CL1 | CL5
| CL2 | CL2
| CL3 | CL3

Here I need to show multiple values for both the properties.

Please suggest.

Thanks,
navdimri

navdimri
21 Aug 2009, 2:40 AM
Hi Condor,

I am attaching my requirement, so that it can be more clear to you.

Here, how can I display multiple values under all columns for the property branch-user?

please suggest, as I need to resolve this problem ASAP.

Thanks in advance,
navdimri

Condor
21 Aug 2009, 3:42 AM
So you only need multiple values in a single cell? You can solve that with a renderer (return values separated by <br />).

navdimri
21 Aug 2009, 4:33 AM
Hi Condor,

Thanks for replying so quick, let me try to implement that.
I'll again disturb you, if i face any problem.

Regards,
navdimri

navdimri
24 Aug 2009, 8:23 AM
Hi Condor,

Do i need to apply for loop to access all values of a single property or they come automatically. Also, in my following renderer :


renderer: function(v, meta, r){

// add a css class if values are different
if(v != r.get(column1)){
meta.css = 'red-css-class';
meta.attr = 'ext:qtip="Correct value is ' + Ext.util.Format.htmlEncode(r.get(column1)) + '"';
}
return v;
}}



how can i retrieve all values using < br />

Please suggest.

Thanks,
navdimri

Condor
24 Aug 2009, 8:49 AM
How are the values store in the record?