PDA

View Full Version : GroupingView setShowGroupedColumn



ram.ghadiyaram@gmail.com
1 Sep 2009, 5:50 AM
GroupingView view = new GroupingView();
// if I pass true explicitly then This property is not working
view.setShowGroupedColumn(true);

is not showing grouped column in the grid.
Seems like there is a bug.

but if I comment this line i.e view.setShowGroupedColumn(true); then its working as expected..
Regards
Ram

micgala
1 Sep 2009, 7:15 AM
Hi.

Please provide a full test case.

What you said does not make sense to me...
Not calling setShowGroupedColumn, or calling setShowGroupedColumn(true) should have the same effect, since the default is true.

Are you sure that in your test case you are calling setShowGroupedColumn prior to the rendering?

Regards,
Michel.

ram.ghadiyaram@gmail.com
2 Sep 2009, 4:36 AM
Hi
Try to create a grouing grid using this method and pass the groupedcolumn "groupBy"
forceFit = true
and showGroupedColumn = true // if you pass the value as "false" grouped column is not displaying that correct test case . if you pass true also groupedccolumn is not displayed..
then you can reproduce this...

public static Grid<ModelData> createGrid(GroupingStore<ModelData> store, ColumnModel columnModel, String groupBy,
boolean forceFit, boolean showGroupedColumn) {
if (groupBy != null) {
store.groupBy(groupBy);
}
final Grid<ModelData> grid = new Grid<ModelData>(store, columnModel);
grid.getView().setEmptyText(Constants.NO_DATA);
grid.setBorders(false);
grid.setLoadMask(true);
grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
grid.setView(getGroupingView(columnModel, forceFit, showGroupedColumn));
return grid;
}

/***

* getGroupingView - get the grouping view.

*
* @param cm ColumnModel

* @param forceFit boolean

* @param showGroupedColumn boolean

* @return GroupingView

*/

public static GroupingView getGroupingView(final ColumnModel cm, boolean forceFit, boolean showGroupedColumn) {
GroupingView view = new GroupingView();
view.setShowGroupedColumn(showGroupedColumn);
view.setForceFit(forceFit);
view.setGroupRenderer(new GridGroupRenderer() {
public String render(GroupColumnData data) {
String f = cm.getColumnById(data.field).getHeader();
String l = data.models.size() == 1 ? "Item" : "Items";
return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
}
});
return view;
}

Arno.Nyhm
2 Sep 2009, 4:47 AM
my guess: you dont setup a columnmodel for this column. so your renderer not works.

did you see any error message and exceptions in the GWT.log?

did you try to use the example code on your system and then set this parameter?
http://extjs.com/examples/explorer.html#grouping


PS: pls pls pls ...
1) post full code: now your columnModel is missing :-(
2) use the
my code tags

micgala
2 Sep 2009, 4:55 AM
Exactly.

I have just double checked with my own code:

When not calling setShowGroupedColumn, or calling it using true, the result is the same: the column IS displayed.

Calling with false: not displayed.

So, this makes me quite sure there is some issue in your code... which could be, as said, in your ColumnModel.

Regards,
Michel