Hi Isomorphic,
please see this video of a ListGrid with validator (ds.xml validator that runs on the client as well) (using v11.1p_2018-02-28):
Steps are:
Please see this testcase (BuiltInDS-based):
BuiltInDS.java:
employees.ds.xml change:
Best regards
Blama
please see this video of a ListGrid with validator (ds.xml validator that runs on the client as well) (using v11.1p_2018-02-28):
Steps are:
- Double click to edit
- Add space to the end of the name
- Enter (-> validation error added, OK)
- Double click to edit
- Remove space from the end of the name
- Enter(-> validation error stays, not OK)
Please see this testcase (BuiltInDS-based):
BuiltInDS.java:
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.Version; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.Criterion; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.SortSpecifier; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.types.SortDirection; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout mainLayout; private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(); } }); mainLayout.addMember(recreateBtn); recreate(); mainLayout.draw(); } private void recreate() { Window w = new Window(); w.setWidth("25%"); w.setHeight("35%"); w.setMembersMargin(0); w.setModalMaskOpacity(70); w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); w.setTitle("Client-side validator not re-run if entry changed back to stored value" + w.getTitle()); w.setShowMinimizeButton(false); w.setIsModal(true); w.setShowModalMask(true); w.centerInPage(); final ListGrid employeesGrid = new ListGrid(DataSource.get("employees")); employeesGrid.setHeight100(); employeesGrid.setAutoFetchData(false); employeesGrid.setCanEdit(true); ListGridField employeeId = new ListGridField("EmployeeId"); ListGridField name = new ListGridField("Name"); ListGridField gender = new ListGridField("Gender"); ListGridField job = new ListGridField("Job"); employeesGrid.setFields(employeeId, name, gender, job); employeesGrid.setSort(new SortSpecifier[] { new SortSpecifier(name.getName(), SortDirection.ASCENDING) }); employeesGrid.fetchData(new AdvancedCriteria(new Criterion(name.getName(), OperatorId.STARTS_WITH, "A"))); w.addItem(employeesGrid); w.show(); } }
Code:
<field name="Name" title="Name" type="text" length="128"> <validators> <validator type="regexp" expression="^[^ \t].*[^ \t]$"> <errorMessage>Whitespace not allowed at beginning or end"</errorMessage> </validator> </validators> </field>
Blama
Comment