Hi Isomorphic,
I have a strange problems with FormItemCriterionGetter and FormItemCriterionSetter.
Please take a look at this test case.
I put breakpoint on every line which start with "SC.logWarn()". No breakpoint is hit.
v11.1p_2018-12-03/PowerEdition Deployment (built 2018-12-03)
This topic is probably related to my problem Bug: CriteriaEditing broken?
Best regards
Pavo
I have a strange problems with FormItemCriterionGetter and FormItemCriterionSetter.
Please take a look at this test case.
I put breakpoint on every line which start with "SC.logWarn()". No breakpoint is hit.
v11.1p_2018-12-03/PowerEdition Deployment (built 2018-12-03)
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.SortSpecifier; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.types.SortDirection; import com.smartgwt.client.types.TextMatchStyle; 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.DynamicForm; import com.smartgwt.client.widgets.form.FormItemCriterionGetter; import com.smartgwt.client.widgets.form.FormItemCriterionSetter; import com.smartgwt.client.widgets.form.fields.FormItem; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.grid.ListGrid; 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(600); setHeight(300); setMembersMargin(0); setModalMaskOpacity(70); setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); setShowMinimizeButton(false); setIsModal(true); setShowModalMask(true); centerInPage(); final ListGrid lg = new ListGrid() { { setShowFilterEditor(true); setDataSource("animals"); ListGridField commonNameLGF = new ListGridField("commonName"); commonNameLGF.setCanFilter(false); ListGridField informationLGF = new ListGridField("information"); informationLGF.setCanFilter(true); informationLGF.setFilterEditorProperties(new TextItem("information") { { setCriterionGetter(new FormItemCriterionGetter() { @Override public Criterion getCriterion(DynamicForm form, FormItem item, TextMatchStyle textMatchStyle) { SC.logWarn("getCriterion 1 never called!"); return this.getCriterion(form, item); } @Override public Criterion getCriterion(DynamicForm form, FormItem item) { SC.logWarn("getCriterion 2 never called!"); Object obj = form.getValue("information"); if (obj == null) { return null; } else { String value = String.valueOf(obj); String[] s = value.split(" "); AdvancedCriteria finalCriteria = new AdvancedCriteria(OperatorId.AND); for (int i = 0; i < s.length; i++) { finalCriteria.addCriteria(new Criterion("information", OperatorId.ICONTAINS, s[i])); } return finalCriteria; } } }); setCriterionSetter(new FormItemCriterionSetter() { @Override public void setCriterion(DynamicForm form, FormItem item, Criterion criterion) { SC.logWarn("setCriterion never called!"); } }); } @Override public Boolean hasAdvancedCriteria() { SC.logWarn("hasAdvancedCriteria never called!"); return true; } }); setFields(commonNameLGF, informationLGF); setInitialSort(new SortSpecifier("commonName", SortDirection.ASCENDING)); fetchData(); } }; addItem(lg); } } }
Best regards
Pavo
Comment