PDA

View Full Version : Dynamically change FlowLayout rows number



dark_nights
17 Aug 2009, 1:17 AM
Hello,
I'm a new Ext GWT user, and I used the LocalPaging Grid Example.
I added a ListBox to the toolBar in the bottom, in order to chose the number of listed rows in the page.
The problem is that I don't know how to make the grid be shown dynamically when I select the new value of the rows number in the ListBox.
Could you help me please ?! :)
PS : I'm using GWT 1.6 and GXT 2.0

Arno.Nyhm
19 Aug 2009, 3:49 AM
i think you mean something like this (but all this are in extjs you have to adopt this to GXT - but it gives you a hint how to do it):


http://edspencer.net/2009/07/extjs-grid-page-size-letting-user.html
http://extjs.com/learn/Plugin:pPageSize (ExtJS 2.0)

[3.x] Ext.ux.grid.PageSizer
http://extjs.com/forum/showthread.php?t=66954&highlight=PageSizer

3.x] Ext.ux.grid.AutoRefresher
http://extjs.com/forum/showthread.php?t=66986

dark_nights
20 Aug 2009, 7:22 AM
Finally I ask the class which contains my Grid to destroy it and construct an onther one with the new value.
It works but I'm sure it's not the best way.

In fact, I have a stupid question :-/
why can't we add an item to an HorizontalPanel for example after removing some elements...
Here an example :


public class Test implements EntryPoint {

final HorizontalPanel hp = new HorizontalPanel();

final HorizontalPanel hp1 = new HorizontalPanel();
final HorizontalPanel hp2 = new HorizontalPanel();

final Button b = new Button("Switch");
final Button b1 = new Button("ONE");
final Button b2 = new Button("TWO");

public void onModuleLoad() {


hp.add(b);
hp.add(b1);


b.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
hp.remove(b1);
hp.add(b2);
hp.recalculate();
}

});

RootPanel.get().add(hp);
}

}

When I click on the button b, the button b1 disappear but the button b2 is not added to hp.
Could you help me please ? I spent more then 2 hours but I didn't find it :(

Thank you :)