PDA

View Full Version : reorder treegrid



fother
10 Aug 2009, 10:40 AM
how to reproduce:
click in the button "load data"
the data will be loaded
you CAN reorder.. its ok
now click again in button "load data"
you CANNOT reorder more.. and dont return any exeception...

tested on win vista hosted mode

my code example was copied from ReorderingTreeGridExample and changed what need :)


public void onModuleLoad() {

final LayoutContainer container = new LayoutContainer();
container.setLayout(new FlowLayout(10));

final TreeStore<ModelData> store = new TreeStore<ModelData>();

final ColumnConfig name = new ColumnConfig("name", "Name", 100);
name.setRenderer(new TreeGridCellRenderer<ModelData>());

final ColumnConfig date = new ColumnConfig("author", "Author", 100);
final ColumnConfig size = new ColumnConfig("genre", "Genre", 100);
final ColumnModel cm = new ColumnModel(Arrays.asList(name, date, size));

final ContentPanel cp = new ContentPanel();
cp.setBodyBorder(false);
cp.setFrame(true);
cp.setHeading("Reordering TreeGrid Example");
cp.setButtonAlign(HorizontalAlignment.CENTER);

cp.setLayout(new FitLayout());
cp.setSize(500, 350);

final TreeGrid<ModelData> tree = new TreeGrid<ModelData>(store, cm);
tree.setBorders(true);
tree.getStyle().setLeafIcon(Examples.ICONS.music());
tree.setAutoExpandColumn("name");
tree.setTrackMouseOver(false);

new TreeGridDragSource(tree);

final TreeGridDropTarget target = new TreeGridDropTarget(tree);
target.setAllowSelfAsSource(true);
target.setFeedback(Feedback.BOTH);

cp.add(tree);
cp.addButton(new Button("load data", new SelectionListener<ButtonEvent>() {

@Override
public void componentSelected(final ButtonEvent ce) {

final Folder model = TestData.getTreeModel();
store.removeAll();
store.add(model.getChildren(), true);
}
}));

container.add(cp);

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

fother
10 Aug 2009, 10:44 AM
any ideia.. what its wrong?

fother
10 Aug 2009, 11:04 AM
return this exception in TreeGridDropTarget in the line 160




com.google.gwt.core.client.JavaScriptException: (TypeError): 'className' é nulo ou não é um objeto
number: -2146823281
description: 'className' é nulo ou não é um objeto