PDA

View Full Version : Grid Force "Loading..." Animation



sandile.keswa
20 Jul 2009, 8:26 AM
Hey,

I'm new to gxt technology and so have a limited understanding; however, I have been exceptional difficulty in force showing the "Loading..." animation in a Grid. I would use an RpcProxy, but the solution I'm working on specifically requires independent RPC calls to update the listStore behind the grid. Help in any form would be much appreciated.

Thanks,

--Sandile

sandile.keswa
20 Jul 2009, 1:36 PM
I used Grid<M>.mask(); to achieve the desired effect.

mark.clement
21 Jul 2009, 12:15 AM
Hi Sandile

Im using an editor grid, and to display the loading mask i use the following :

superCoolEditorGrid.el().mask("Loading"); // Displays mask with the text loading
superCoolEditorGrid.el().unmask(); // Removes loading mask

Hope it helps

Mark

mark.clement
21 Jul 2009, 12:26 AM
This is how i used it in a working example:

Some Action Listener

someComboBox.addSelectionChangedListener(new SelectionChangedListener<BeanModel>() {
@Override
public void selectionChanged(SelectionChangedEvent<BeanModel> se) {
if(se.getSelectedItem() != null && se.getSelectedItem().get("someValue") != null) {
Long someValue = se.getSelectedItem().get("someValue");
superCoolEditorGrid.el().mask("Loading");
loadValues(someValue);
}
}
});
Gets Values And loads them into the editorGrid

private void loadValues(Long someValue) {
parameterValueService.getSomeValues(someValue, new AsyncCallback<List<SomeValue>>() {
public void onFailure(Throwable caught) {
superCoolEditorGrid.el().unmask();
// Do some error handling for not retrieving values
}

public void onSuccess(List<SomeValue> result) {

BeanModelFactory factory = BeanModelLookup.get().getFactory(SomeValue.class);
List<BeanModel> model = factory.createModel(result);

someValueStore.removeAll();
someValueStore.add(model);
someValueLoader.load();

superCoolEditorGrid.el().unmask();

superCoolEditorGrid.getView().refresh(true);
}
});
} Hope it helps!

sandile.keswa
21 Jul 2009, 8:17 AM
Thanks guys, you've been extremely helpful