maqjav
4 Dec 2010, 12:33 AM
Hello.
I am going to write my code so it will be easier to explain what happends.
// Website container
LayoutContainer website = new LayoutContainer(new RowLayout());
// Body container
LayoutContainer body = new LayoutContainer(new HBoxLayout());
// I reuse the body in other place
body.removeAll();
// Left column
LayoutContainer leftColumn= new LayoutContainer(new RowLayout());
leftColumn.setWidth(620);
// ContentPanel with grid
ContentPanel listPanel = new ContentPanel(new RowLayout());
final FilesServiceAsync service = commons.getFiles();
RpcProxy<PagingLoadResult<TFilesModel>> proxy = new RpcProxy<PagingLoadResult<TFilesModel>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<PagingLoadResult<TFilesModel>> callback) {
service.getFiles((PagingLoadConfig) loadConfig, callback);
}
};
final PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy);
ListStore<TFilesModel> store = new ListStore<TFilesModel>(loader);
// Grid columns definitions....
ColumnModel cm = new ColumnModel(columns);
final Grid<TFichasModel> grid = new Grid<TFilesModel>(store, cm);
grid.setStateId("listFilesStateGrid");
grid.setStateful(true);
grid.addListener(Events.Attach, new Listener<GridEvent<TFilesModel>>() {
public void handleEvent(GridEvent<TFilesModel> be) {
PagingLoadConfig config = new BasePagingLoadConfig();
config.setOffset(0);
config.setLimit(20);
cargador.load(config);
}
});
grid.setWidth(620);
grid.setAutoHeight(true);
grid.setBorders(false);
grid.setLoadMask(true);
// Page bar...
// Add the grid to the listPanel
listPanel.add(grid, new RowData(-1, -1));
// Add the list to the column
leftColumn.add(listPanel, new RowData(-1, -1));
// More contentPanels with more stuff
// Add the column to the body
body.add(leftColumn, new HBoxLayoutData());
// Layout the main container
((LayoutContainer)body.getParent()).layout();
The code I attached it works perfectly but it has a mistake.
As the grid doesn't have files initially, when I layout() the main container it gives to the grid the height of 0 rows, so when it loads the files (lets say 10 rows), it pushes down all the contentPanels below the listPanel.
Is there a solution to fix this behavior?
Thank you.
I am going to write my code so it will be easier to explain what happends.
// Website container
LayoutContainer website = new LayoutContainer(new RowLayout());
// Body container
LayoutContainer body = new LayoutContainer(new HBoxLayout());
// I reuse the body in other place
body.removeAll();
// Left column
LayoutContainer leftColumn= new LayoutContainer(new RowLayout());
leftColumn.setWidth(620);
// ContentPanel with grid
ContentPanel listPanel = new ContentPanel(new RowLayout());
final FilesServiceAsync service = commons.getFiles();
RpcProxy<PagingLoadResult<TFilesModel>> proxy = new RpcProxy<PagingLoadResult<TFilesModel>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<PagingLoadResult<TFilesModel>> callback) {
service.getFiles((PagingLoadConfig) loadConfig, callback);
}
};
final PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy);
ListStore<TFilesModel> store = new ListStore<TFilesModel>(loader);
// Grid columns definitions....
ColumnModel cm = new ColumnModel(columns);
final Grid<TFichasModel> grid = new Grid<TFilesModel>(store, cm);
grid.setStateId("listFilesStateGrid");
grid.setStateful(true);
grid.addListener(Events.Attach, new Listener<GridEvent<TFilesModel>>() {
public void handleEvent(GridEvent<TFilesModel> be) {
PagingLoadConfig config = new BasePagingLoadConfig();
config.setOffset(0);
config.setLimit(20);
cargador.load(config);
}
});
grid.setWidth(620);
grid.setAutoHeight(true);
grid.setBorders(false);
grid.setLoadMask(true);
// Page bar...
// Add the grid to the listPanel
listPanel.add(grid, new RowData(-1, -1));
// Add the list to the column
leftColumn.add(listPanel, new RowData(-1, -1));
// More contentPanels with more stuff
// Add the column to the body
body.add(leftColumn, new HBoxLayoutData());
// Layout the main container
((LayoutContainer)body.getParent()).layout();
The code I attached it works perfectly but it has a mistake.
As the grid doesn't have files initially, when I layout() the main container it gives to the grid the height of 0 rows, so when it loads the files (lets say 10 rows), it pushes down all the contentPanels below the listPanel.
Is there a solution to fix this behavior?
Thank you.