catacaustic
13 May 2009, 5:37 PM
I'm trying to set up a ComboBox that loads it's list depending on the value of a second ComboBox. The first ComboBox is no problem, but I can't figure out how to set up the loader of the dependent ComboBox to send the value that I need back to the server.
I've implemented this as a new class extending ComboBox so the store, loader and these listeners are all implemented in the main constructor.
I've tried both of these listeners to see if I can get it working:
Attempt 1...
loader.addLoadListener (new LoadListener () {
public void loaderBeforeLoad (LoadEvent le) {
BaseListLoadConfig config = new BaseListLoadConfig ();
Map params = config.getParams ();
params.put("id", server_id);
loader.useLoadConfig (config);
} // beforeLoad ()
});
Attempt 2...
addListener (Events.BeforeQuery, new Listener<FieldEvent> () {
public void handleEvent(FieldEvent be) {
BaseListLoadConfig config = new BaseListLoadConfig ();
Map params = config.getParams ();
params.put("id", server_id);
config.setParams (params);
loader.useLoadConfig (config);
} // handleEvent ()
});
Both of these set the value correctly in the loaders config, but when the loader loads, it doesn't send this value.
Is this how it should be done, or is there another method of sending parameters back from the loader?
I've implemented this as a new class extending ComboBox so the store, loader and these listeners are all implemented in the main constructor.
I've tried both of these listeners to see if I can get it working:
Attempt 1...
loader.addLoadListener (new LoadListener () {
public void loaderBeforeLoad (LoadEvent le) {
BaseListLoadConfig config = new BaseListLoadConfig ();
Map params = config.getParams ();
params.put("id", server_id);
loader.useLoadConfig (config);
} // beforeLoad ()
});
Attempt 2...
addListener (Events.BeforeQuery, new Listener<FieldEvent> () {
public void handleEvent(FieldEvent be) {
BaseListLoadConfig config = new BaseListLoadConfig ();
Map params = config.getParams ();
params.put("id", server_id);
config.setParams (params);
loader.useLoadConfig (config);
} // handleEvent ()
});
Both of these set the value correctly in the loaders config, but when the loader loads, it doesn't send this value.
Is this how it should be done, or is there another method of sending parameters back from the loader?