Dear Support,
I would like to know how you recommend to do the following:
- Have a DynamicForm initialized with initial data (autofetched from given criteria)
- Have a simple way to refresh the data
Here is a simple example which mimics what I tried... The initial data is correct, but the invalidateCache() call does not trigger a new fetch when I click the button (did check the dev console)...
The datasource:
The small example:
Thank you very much for your help,
Thomas
I would like to know how you recommend to do the following:
- Have a DynamicForm initialized with initial data (autofetched from given criteria)
- Have a simple way to refresh the data
Here is a simple example which mimics what I tried... The initial data is correct, but the invalidateCache() call does not trigger a new fetch when I click the button (did check the dev console)...
The datasource:
Code:
<DataSource
ID="reg_decision"
serverType="sql"
tableName="REG_DECISION"
useAnsiJoins="true"
>
<fields>
<field name="ID" type="integer" hidden="true" primaryKey="true"/>
<field name="CUSTOMER_ID" type="integer" hidden="true" foreignKey="cif_customer.ID"/>
<field name="REGULATION_ID" type="integer" hidden="true" foreignKey="reg_regulation.ID" />
<field name="REGULATION" type="text" includeFrom="reg_regulation.NAME" />
<field name="ANSWER_ID" type="integer" hidden="true" foreignKey="reg_answer.ID" joinType="outer"/>
<field name="CLASSIFICATION" type="text" includeFrom="reg_answer.NAME" />
<field name="CLASSIFICATION_DATE" type="date" nativeName="CREATED" />
</fields>
</DataSource>
Code:
public class Test extends VLayout {
public Test() {
final DynamicForm test = new DynamicForm();
test.setDataSource(DataSource.get("reg_decision"));
Criteria criteria = new Criteria("CUSTOMER_ID", "3");
criteria.addCriteria("REGULATION", "XXX");
test.setAutoFetchData(true);
test.setInitialCriteria(criteria);
this.addMember(test);
Button button = new Button("Update");
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
test.invalidateCache();
}
});
this.addMember(test);
this.addMember(button);
}
}
Thomas
Comment