i have a combobox , these values are the result returned by a service using criteria
the criteria works well and the result is displayed in the combo box but the filter on which no longer works.
inseeCombo, CommuneCombo, LieuditCombo are the three combobox used in my code on which the filter is not working.
this.commune.addChangedHandler(new
com.smartgwt.client.widgets.grid.events.ChangedHandler() {
@Override
public void onChanged(
final com.smartgwt.client.widgets.grid.events.ChangedEvent event) {
if(event.getValue()!=null && event.getForm().getField(FieldsName.OU_CODE_POST).getValue()!=null)
{
Date da = new Date();
//event.getForm().getField(FieldsName.OU_INSEE).clearValue();
event.getForm().getField(FieldsName.OU_LIEUDIT).clearValue();
String codeCommune = event.getValue().toString();
String codePostal = event.getForm().getField(FieldsName.OU_CODE_POST).getValue().toString();
final Criteria communeCriteria= new Criteria(FieldsName.OU_COMMUNE,codeCommune);
communeCriteria.addCriteria(FieldsName.OU_CODE_POST,codePostal);
communeCriteria.addCriteria("tDp", da);
commune.setOptionCriteria(communeCriteria);
insee.setOptionCriteria(communeCriteria);
Lieudit.setOptionCriteria(communeCriteria);
SearchDatasource.getInstance().fetchData(communeCriteria, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
Record[] records = response.getData();
if (records != null && records.length >1)
{
event.getForm().getField(FieldsName.OU_LIEUDIT).setOptionCriteria(communeCriteria);
}
if (records != null && records.length ==1)
{
Record record = records[0];
event.getForm().getField(FieldsName.OU_LIEUDIT).setValue(record.getAttribute(FieldsName.OU_LIEUDIT));
event.getForm().getField(FieldsName.OU_LIEUDIT).focusInItem();
event.getForm().getField(FieldsName.OU_INSEE).setValue(record.getAttribute(FieldsName.OU_INSEE));
event.getForm().getField(FieldsName.OU_INSEE).focusInItem();
}
}
});
}
}
});
the criteria works well and the result is displayed in the combo box but the filter on which no longer works.
inseeCombo, CommuneCombo, LieuditCombo are the three combobox used in my code on which the filter is not working.
this.commune.addChangedHandler(new
com.smartgwt.client.widgets.grid.events.ChangedHandler() {
@Override
public void onChanged(
final com.smartgwt.client.widgets.grid.events.ChangedEvent event) {
if(event.getValue()!=null && event.getForm().getField(FieldsName.OU_CODE_POST).getValue()!=null)
{
Date da = new Date();
//event.getForm().getField(FieldsName.OU_INSEE).clearValue();
event.getForm().getField(FieldsName.OU_LIEUDIT).clearValue();
String codeCommune = event.getValue().toString();
String codePostal = event.getForm().getField(FieldsName.OU_CODE_POST).getValue().toString();
final Criteria communeCriteria= new Criteria(FieldsName.OU_COMMUNE,codeCommune);
communeCriteria.addCriteria(FieldsName.OU_CODE_POST,codePostal);
communeCriteria.addCriteria("tDp", da);
commune.setOptionCriteria(communeCriteria);
insee.setOptionCriteria(communeCriteria);
Lieudit.setOptionCriteria(communeCriteria);
SearchDatasource.getInstance().fetchData(communeCriteria, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
Record[] records = response.getData();
if (records != null && records.length >1)
{
event.getForm().getField(FieldsName.OU_LIEUDIT).setOptionCriteria(communeCriteria);
}
if (records != null && records.length ==1)
{
Record record = records[0];
event.getForm().getField(FieldsName.OU_LIEUDIT).setValue(record.getAttribute(FieldsName.OU_LIEUDIT));
event.getForm().getField(FieldsName.OU_LIEUDIT).focusInItem();
event.getForm().getField(FieldsName.OU_INSEE).setValue(record.getAttribute(FieldsName.OU_INSEE));
event.getForm().getField(FieldsName.OU_INSEE).focusInItem();
}
}
});
}
}
});
Comment