Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Strange bug in DynamicForm

$
0
0
Hi,

I encountered the following problem (bug?) when using DynamicForms:

Here is my class:

Code:

class NewOperatorForm extends DynamicForm {
               
                NewOperatorForm() {
                        TextItem                        loginItem = new TextItem(DSOperator.LOGIN, "Login");
                        TextItem                nameItem = new TextItem(DSOperator.NAME, "Name");
                        TextItem                        departmentItem = new TextItem(DSOperator.DEPARTMENT, "Department");
                        TextItem                        emailItem = new TextItem(DSOperator.EMAIL, "Email");
                        SelectItem                        bunitItem = new SelectItem(DSOperator.BUNIT_ID, "Business Unit");
                       
                        bunitItem.setOptionDataSource(DataSource.get(DSBusinessUnit.DS_NAME));
                        bunitItem.setAutoFetchData(true);
                        bunitItem.setDefaultToFirstOption(true);
                       
                        this.setDataSource(DataSource.get(DSOperator.DS_NAME));
                        this.setItems(bunitItem, loginItem, nameItem, departmentItem, emailItem);
                       
                        Record r = new Record();
                        this.editNewRecord(r);
                }               
        }

You can notice that the SelectItem gets the data from another datasource and that setDefaultToFirstOption(true) is called.

The first time I create and show an instance of this dynamicform. Everything is ok: the SelectItem fetches all the data and the first item is selected by default (ID: 1).

The second time (though it's an other instance), very surprisingly, the SelectItem does contain all the items but the first one is not selected (it's blank)... but the value is instead set into the second item of the form (I've got the "1" value in my text field). This seems very odd but I did not add any code which could lead to such a behaviour...

Thanks a lot for your help!

Thomas

Viewing all articles
Browse latest Browse all 4756

Trending Articles