In the following example I am using ValidatorType.READONLY with validateOnChange feature (real application case uses applyWhen criteria also).
When user enters grid edit mode then "code" field is protected - nothing can be entered in it, as desired.
However, when user enters filter for the same "code" field, then writing anything to filter data is also protected. This is NOT desired, as you already explained in this archive thread.
Similar problem exists when such a DataSourceField with this kind of validator is bounded to FilterBuilder.
Thanks,
MichalG
SmartClient Version: v10.0p_2015-02-02/LGPL Development Only (built 2015-02-02)
Firefox 24.8.0 (Gentoo linux)
When user enters grid edit mode then "code" field is protected - nothing can be entered in it, as desired.
However, when user enters filter for the same "code" field, then writing anything to filter data is also protected. This is NOT desired, as you already explained in this archive thread.
Similar problem exists when such a DataSourceField with this kind of validator is bounded to FilterBuilder.
Code:
package pl.com.tech4.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.DOM; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.DataSourceField; import com.smartgwt.client.data.fields.DataSourceTextField; import com.smartgwt.client.types.ValidatorType; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.events.DropMoveEvent; import com.smartgwt.client.widgets.events.DropMoveHandler; import com.smartgwt.client.widgets.form.validator.Validator; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridRecord; public class MainEntryPoint implements EntryPoint { public void onModuleLoad() { DOM.getElementById("loadingPicture").removeFromParent(); layout(); SC.showConsole(); } private void layout() { DataSource ds = new DataSource(); DataSourceField fieldId = new DataSourceField(); fieldId.setName("id"); fieldId.setPrimaryKey(true); fieldId.setHidden(true); DataSourceTextField fieldCode = new DataSourceTextField(); fieldCode.setName("code"); Validator validator = new Validator(); validator.setType(ValidatorType.READONLY); validator.setValidateOnChange(true); fieldCode.setValidators(validator); ds.setFields(fieldId, fieldCode); ListGrid lg = new ListGrid(); lg.setDataSource(ds); ListGridRecord[] records = new ListGridRecord[2]; records[0] = new ListGridRecord(); records[0].setAttribute("id", "1"); records[0].setAttribute("code", "m/s"); records[1] = new ListGridRecord(); records[1].setAttribute("id", "2"); records[1].setAttribute("code", "knots"); lg.setData(records); lg.setCanEdit(true); lg.setShowFilterEditor(true); lg.draw(); } }
MichalG
SmartClient Version: v10.0p_2015-02-02/LGPL Development Only (built 2015-02-02)
Firefox 24.8.0 (Gentoo linux)
Comment