Hi,
But this parameter (token) is missing in the url. We have used the same code to load a Grid and the parameter is added to the url correctly.
We are trying to add a parameter (token) to every ComboBox load request by setting it in the load config of the loader.
Below is sample code:
Code:
ComboBox<BeanModel> cmbMyStatus = new ComboBox<BeanModel>();
cmbMyStatus = new ComboBox<BeanModel>();
cmbMyStatus .setId("mystatus");
cmbMyStatus .setName("mystatus");
cmbMyStatus .setFieldLabel("My Status");
cmbMyStatus .setStore(getMyStatusStore());
cmbMyStatus .setValueField("myStatusId");
cmbMyStatus .setDisplayField("myStatusNm");
cmbMyStatus .setTypeAhead(true);
cmbMyStatus .setEditable(false);
cmbMyStatus .setToolTip("Select a Status...");
cmbMyStatus .setTriggerAction(TriggerAction.ALL);
binding.addFieldBinding(new ComboBoxFieldBinding(cmbMyStatus, "myStatusId"));
private ListStore<BeanModel> getMyStatusStore() {
ModelType type = new ModelType();
type.setRoot("myStatus");
type.addField("myStatusId");
type.addField("myStatusNm");
final String url = URLBuilder.createURI("ws/status/mystatuses", false);
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
HttpProxy<String> proxy = new HttpProxy<String>(builder);
JsonLoadResultReader<ListLoadResult<ModelData>> reader = new JsonLoadResultReader<ListLoadResult<ModelData>>(type);
final BaseListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy, reader);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);
store.addListener(Store.DataChanged, new Listener<StoreEvent<?>>() {
@Override
public void handleEvent(StoreEvent<?> be) {
binding.getBinding(cmbMyStatus).updateField();
}
});
ModelData loadConfig = new BaseModelData();
loadConfig.set("nonce", MyRegistry.getCSRFToken());
loader.load(loadConfig);
return store;
}
But this parameter (token) is missing in the url. We have used the same code to load a Grid and the parameter is added to the url correctly.
What are we missing here? Is there any better way of handling this?
Aucun commentaire:
Enregistrer un commentaire