Hi,
This is the test case in which FilterBuilder is bounded to the DataSource. DataSource field 'employer' has editorProperties set; among them width is set to fill available space '*':
Above code is working fine as shown here: code field (which is first on the list and drawn initially), fills all available width allowing pickList to adjust to the titles width.
Now change the line:
to:
so the description field is initially first and run again.
and choose Employer field:
This time width of employer field is not extended to fill form space and pickList is also narrowed and ignoring adjusting to titles.
Thanks,
MichalG
SmartClient Version: v11.0p_2016-07-07/LGPL Development Only (built 2016-07-07)
FF 24.8.0 and Chrominium 38.0.2125.101
Data xml files:
Employment.xml
Department.xml
This is the test case in which FilterBuilder is bounded to the DataSource. DataSource field 'employer' has editorProperties set; among them width is set to fill available space '*':
Code:
import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.DataSourceField; import com.smartgwt.client.data.OperationBinding; import com.smartgwt.client.data.fields.DataSourceTextField; import com.smartgwt.client.types.AutoFitWidthApproach; import com.smartgwt.client.types.DSDataFormat; import com.smartgwt.client.types.DSOperationType; import com.smartgwt.client.types.DSProtocol; import com.smartgwt.client.widgets.form.FilterBuilder; import com.smartgwt.client.widgets.form.fields.ComboBoxItem; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; public class MainEntryPoint implements EntryPoint { public void onModuleLoad() { layout(); } private void layout() { DataSource employmentDS = new DataSource(); employmentDS.setID("Employment"); OperationBinding fetchBinding = new OperationBinding(); fetchBinding.setOperationType(DSOperationType.FETCH); fetchBinding.setDataFormat(DSDataFormat.XML); fetchBinding.setDataProtocol(DSProtocol.POSTXML); employmentDS.setOperationBindings(fetchBinding); employmentDS.setDataURL("Employment.xml"); DataSource departmentDS = new DataSource(); departmentDS.setID("Department"); departmentDS.setOperationBindings(fetchBinding); departmentDS.setDataURL("Department.xml"); DataSourceField idDepField = new DataSourceField(); idDepField.setName("id"); idDepField.setPrimaryKey(true); idDepField.setHidden(true); DataSourceTextField codeField = new DataSourceTextField(); codeField.setName("code"); departmentDS.setFields(idDepField, codeField); DataSourceField idField = new DataSourceField(); idField.setName("id"); idField.setPrimaryKey(true); idField.setHidden(true); DataSourceField employerField = new DataSourceField(); employerField.setName("employer"); employerField.setForeignKey("Department.id"); employerField.setValueXPath("employer/id"); ComboBoxItem defaultItem = new ComboBoxItem("employer"); defaultItem.setOptionDataSource(departmentDS); defaultItem.setValueField("id"); defaultItem.setDisplayField("code"); defaultItem.setWidth("*"); defaultItem.setPickListFields(new ListGridField("id", "A very long iddddddddddddddddd title"), new ListGridField("code", "A very longggggggggggggggggggggggggg code title")); ListGrid pickListProperties = new ListGrid(); pickListProperties.setAutoFitFieldWidths(true); pickListProperties.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH); // pickListProperties.setCanResizeFields(true); defaultItem.setPickListProperties(pickListProperties); employerField.setEditorProperties(defaultItem); DataSourceTextField descriptionField = new DataSourceTextField(); descriptionField.setName("description"); employmentDS.setFields(idField, employerField, descriptionField); FilterBuilder fb = new FilterBuilder(); fb.setDataSource(employmentDS); fb.setWidth100(); fb.draw(); } }
Now change the line:
Code:
employmentDS.setFields(idField, employerField, descriptionField);
Code:
employmentDS.setFields(idField, descriptionField, employerField);
and choose Employer field:
This time width of employer field is not extended to fill form space and pickList is also narrowed and ignoring adjusting to titles.
Thanks,
MichalG
SmartClient Version: v11.0p_2016-07-07/LGPL Development Only (built 2016-07-07)
FF 24.8.0 and Chrominium 38.0.2125.101
Data xml files:
Employment.xml
Code:
<response> <status>STATUS_SUCCESS</status> <startRow>0</startRow> <endRow>1</endRow> <totalRows>2</totalRows> <data> <Employment> <id>20</id> <employer> <id>3</id> <code>Microsoft</code> </employer> </Employment> <Employment> <id>21</id> <employer> <id>4</id> <code>Apple</code> </employer> </Employment> </data> </response>
Code:
<response> <status>STATUS_SUCCESS</status> <startRow>0</startRow> <endRow>4</endRow> <totalRows>5</totalRows> <data> <Department> <id>1</id> <code>Oracle</code> <parentId> <id>2</id> <code>Sun</code> </parentId> </Department> <Department> <id>2</id> <code>Sun</code> <parentId> <id>2</id> <code>Sun</code> </parentId> </Department> <Department> <id>3</id> <code>Microsoft</code> <parentId> <id>2</id> <code>Sun</code> </parentId> </Department> <Department> <id>4</id> <code>Apple</code> <parentId> <id>2</id> <code>Sun</code> </parentId> </Department> </data> </response>
Comment