Hi Isomorphic,
please take a look at this one.
If I use the same validator for ListGridField then it works as expected (dietLGF.setValidators(validator);).
Is this a bug or I'm doing something wrong?
Using 12.0p/v12.0p_2018-09-18
Best regards
Pavo
please take a look at this one.
If I use the same validator for ListGridField then it works as expected (dietLGF.setValidators(validator);).
Is this a bug or I'm doing something wrong?
Using 12.0p/v12.0p_2018-09-18
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.types.OperatorId; import com.smartgwt.client.types.ValidatorType; 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.form.fields.FormItem; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.form.validator.Validator; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridEditorContext; import com.smartgwt.client.widgets.grid.ListGridEditorCustomizer; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS extends VLayout implements EntryPoint { 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(); } }); setWidth100(); setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { new MyWindow().show(); } }); addMember(recreateBtn); new MyWindow().show(); draw(); } private class MyWindow extends Window { public MyWindow() { setWidth(800); setHeight(600); setMembersMargin(0); setModalMaskOpacity(70); setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); SC.logWarn(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); setShowMinimizeButton(false); setIsModal(true); setShowModalMask(true); centerInPage(); ListGrid mainLG = new MainLG(); addItem(mainLG); } private class MainLG extends ListGrid { public MainLG() { setDataSource("animals"); setEditorCustomizer(new ListGridEditorCustomizer() { @Override public FormItem getEditor(ListGridEditorContext context) { if (context.getEditedRecord().getAttributeAsString("commonName").startsWith("Elephant")) { if ("diet".equals(context.getEditField().getName())) { TextItem ti = new TextItem("diet"); Validator validator = new Validator(); validator.setType(ValidatorType.ISINTEGER); ti.setValidators(validator); ti.setValidateOnChange(true); return ti; } } return null; } }); ListGridField commonNameLGF = new ListGridField("commonName"); ListGridField dietLGF = new ListGridField("diet"); dietLGF.setCanEdit(true); setFields(commonNameLGF, dietLGF); fetchData(new AdvancedCriteria(new Criterion("commonName", OperatorId.STARTS_WITH, "Elephant"))); } } } }
Pavo
Comment