Hi Isomorphic,
please see the attached BuiltInDS-based testcase (v12.0p_2018-12-13) and video.
It seems, there is some issue with ListGrid-display of the cacheSync values after successful ListGrid edit (the last edit is the one that is not displayed accordingly).
I assume this is not related to validationContext.setResultingValue(), but I saw it with this when I tested it in my application.
I assume this is related somehow to either TextAreaItem and/or Hilite and also a timing issue, as it does not happen always (see the video).
The video taken using FF26 and SuperDevMode. It happend in my application using current Chrome and SuperDevMode.
BuiltInDS.java:
TestValidator.java:
supplyItem.ds.xml:
Best regards
Blama
please see the attached BuiltInDS-based testcase (v12.0p_2018-12-13) and video.
It seems, there is some issue with ListGrid-display of the cacheSync values after successful ListGrid edit (the last edit is the one that is not displayed accordingly).
I assume this is not related to validationContext.setResultingValue(), but I saw it with this when I tested it in my application.
I assume this is related somehow to either TextAreaItem and/or Hilite and also a timing issue, as it does not happen always (see the video).
The video taken using FF26 and SuperDevMode. It happend in my application using current Chrome and SuperDevMode.
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.Hilite; 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.form.fields.TextAreaItem; 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("45%"); w.setMembersMargin(0); w.setModalMaskOpacity(70); w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); w.setTitle("TITLE" + w.getTitle()); w.setShowMinimizeButton(false); w.setIsModal(true); w.setShowModalMask(true); w.centerInPage(); final ListGrid supplyItemGrid = new ListGrid(DataSource.get("supplyItem")); supplyItemGrid.setHilites(new Hilite[] { new MandatoryAndNotVisibleHilite() }); supplyItemGrid.setHeight100(); supplyItemGrid.setWidth100(); supplyItemGrid.setCanEdit(true); supplyItemGrid.setAutoFetchData(false); ListGridField itemID = new ListGridField("itemID"); ListGridField itemName = new ListGridField("itemName"); ListGridField sku = new ListGridField("SKU"); sku.setEditorProperties(new TextAreaItem()); ListGridField category = new ListGridField("category"); supplyItemGrid.setFields(itemID, itemName, sku, category); supplyItemGrid.setSort(new SortSpecifier[] { new SortSpecifier(itemName.getName(), SortDirection.ASCENDING) }); supplyItemGrid.fetchData(new AdvancedCriteria(new Criterion(itemName.getName(), OperatorId.STARTS_WITH, "A"))); w.addItem(supplyItemGrid); w.show(); } private class MandatoryAndNotVisibleHilite extends Hilite { public MandatoryAndNotVisibleHilite() { super(); setFieldNames(new String[] { "SKU", "category" }); setBackgroundColor("#CD5C5C"); setCriteria(new AdvancedCriteria(OperatorId.AND, new Criterion[] { new Criterion("category", OperatorId.EQUALS, "General Office Products") })); } } }
Code:
package com.smartgwt.sample.server.listener; import java.util.Map; import javax.servlet.http.HttpServletRequest; import com.isomorphic.datasource.DSResponse; import com.isomorphic.datasource.DataSource; import com.isomorphic.datasource.ValidationContext; import com.isomorphic.datasource.Validator; import com.isomorphic.log.Logger; public class TestValidator { Logger log = new Logger(DSResponse.class.getName()); public boolean condition(Object value, Validator validator, String fieldName, @SuppressWarnings("rawtypes") Map record, DataSource ds, HttpServletRequest httpServletRequest, ValidationContext validationContext) throws Exception { log.info("TestValidator called"); validationContext.setResultingValue("123456"); return true; } }
Code:
<DataSource ID="supplyItem" serverType="sql" tableName="supplyItem" titleField="itemName" testFileName="/examples/shared/ds/test_data/supplyItem.data.xml" dbImportFileName="/examples/shared/ds/test_data/supplyItemLarge.data.xml" > <fields> <field name="itemID" type="sequence" hidden="true" primaryKey="true"/> <field name="itemName" type="text" title="Item" length="128" required="true" /> <field name="SKU" type="text" title="SKU" length="10" required="true"> <validators> <validator type="serverCustom" dependentFields="inStock, unitCost"> <serverObject lookupStyle="new" className="com.smartgwt.sample.server.listener.TestValidator" /> <errorMessage>$errorMessage</errorMessage> </validator> </validators> </field> <field name="description" type="text" title="Description" length="2000"/> <field name="category" type="text" title="Category" length="128" required="true" foreignKey="supplyCategory.categoryName"/> <field name="units" type="enum" title="Units" length="5"> <valueMap> <value>Roll</value> <value>Ea</value> <value>Pkt</value> <value>Set</value> <value>Tube</value> <value>Pad</value> <value>Ream</value> <value>Tin</value> <value>Bag</value> <value>Ctn</value> <value>Box</value> </valueMap> </field> <field name="unitCost" type="float" title="Unit Cost" required="true"> <validators> <validator type="floatRange" min="0" errorMessage="Please enter a valid (positive) cost"/> <validator type="floatPrecision" precision="2" errorMessage="The maximum allowed precision is 2"/> </validators> </field> <field name="inStock" type="boolean" title="In Stock"/> <field name="nextShipment" type="date" title="Next Shipment"/> </fields> </DataSource>
Blama
Comment