PDA

View Full Version : AggregationRowConfig Issue.



shajeerkt
3 Nov 2009, 6:47 AM
Dear All,

Need a help .
I was trying to display the sum of a column in my Grid.
Initially before the grid is loaded i can see the 'Maximum' row which i added.
But as soon as the grid is loaded with the datas the row gets hidden.
I dont know were it goes .
But the datas loaded in the grid is viewable.Only problem is with the aggregation row.

Below is the code that i used for grid loading,store and all.


This is my Model


public class DisconnectNewConnectData extends BaseTreeModel implements IsSerializable{
:
:
}



Here i am loading the grid which i retreves using an RpcProxy.



List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
GridCellRenderer<DisconnectNewConnectData> buttonRenderer = new GridCellRenderer<DisconnectNewConnectData>() {

private boolean init;

public Object render(final DisconnectNewConnectData model, String property, ColumnData config, final int rowIndex,
final int colIndex, ListStore<DisconnectNewConnectData> store, final Grid<DisconnectNewConnectData> grid) {

return "Something";

}

column = new ColumnConfig();
column.setId("rate_plan");
column.setHeader("Rate Plan");
column.setWidth(150);
column.setRenderer(buttonRenderer);
configs.add(column);

column = new ColumnConfig();
column.setId("new_install");
column.setHeader("New Install");
column.setWidth(200);
configs.add(column);


column = new ColumnConfig();
column.setId("disconnect");
column.setHeader("Disconnect");
column.setWidth(200);
configs.add(column);

column = new ColumnConfig();
column.setId("total_working_lines");
column.setHeader("Total Working Lines");
column.setWidth(200);
configs.add(column);

final HomeRemoteServiceAsync gwtAsync = (HomeRemoteServiceAsync) Registry.get(Main.HOMESERVICE);

RpcProxy<List<DisconnectNewConnectData>> proxy = new RpcProxy<List<DisconnectNewConnectData>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<List<DisconnectNewConnectData>> callback) {

gwtAsync.giveData(queryName,urlParameters, callback);
}
};

BaseListLoader<ListLoadResult<DisconnectNewConnectData>>(proxy, reader);
BaseListLoader<ListLoadResult<DisconnectNewConnectData>> loader = new BaseListLoader<ListLoadResult<DisconnectNewConnectData>>(proxy);
ListStore<DisconnectNewConnectData> store = new ListStore<DisconnectNewConnectData>(loader);
loader.setRemoteSort(true);
loader.load();


ListStore<DisconnectNewConnectData>(loader);

ColumnModel cm = new ColumnModel(configs);

AggregationRowConfig<DisconnectNewConnectData> averages = new AggregationRowConfig<DisconnectNewConnectData>();

averages = new AggregationRowConfig<DisconnectNewConnectData>();
averages.setHtml("rate_plan", "Maximum");
averages.setSummaryType("total_working_lines", SummaryType.SUM);
NumberFormat.getCurrencyFormat());
averages.setRenderer("total_working_lines", new AggregationRenderer<DisconnectNewConnectData>() {
public Object render(Number value, int colIndex, Grid<DisconnectNewConnectData> grid, ListStore<DisconnectNewConnectData> store) {
if (value != null) {
return NumberFormat.getCurrencyFormat().format(value.doubleValue());
} else {
return "nothing";
}

}
});

cm.addAggregationRow(averages);

northPanel = new ContentPanel();
northPanel.setBodyBorder(false);

northPanel.setButtonAlign(HorizontalAlignment.CENTER);
northPanel.setLayout(new FitLayout());

contentPanel.setTopComponent(createCumulativeToolBar());
grid = new Grid<DisconnectNewConnectData>(store, cm);

grid.setStyleAttribute("borderTop", "none");
grid.setSize(900, 300);
grid.setBorders(false);

grid.setAutoExpandColumn("rate_plan");
northPanel.add(grid);

shajeerkt
4 Nov 2009, 5:46 AM
Please,Some one reply to my query...