Is "$H" in criteria reproducible using my test?
Should I create a new topic for it?
Thanks,
MichalG
Should I create a new topic for it?
Thanks,
MichalG
package pl.com.tech4.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.DataSourceField; import com.smartgwt.client.data.OperationBinding; import com.smartgwt.client.data.Record; import com.smartgwt.client.data.RestDataSource; import com.smartgwt.client.data.fields.DataSourceTextField; import com.smartgwt.client.types.DSDataFormat; import com.smartgwt.client.types.DSOperationType; import com.smartgwt.client.types.DSProtocol; import com.smartgwt.client.types.FieldType; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.util.JSON; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.FilterBuilder; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.VLayout; public class MainEntryPoint implements EntryPoint { public void onModuleLoad() { layout(); SC.showConsole(); } private void layout() { RestDataSource projectDS = new RestDataSource(); OperationBinding fetchBinding = new OperationBinding(); fetchBinding.setOperationType(DSOperationType.FETCH); fetchBinding.setDataFormat(DSDataFormat.XML); fetchBinding.setDataProtocol(DSProtocol.POSTXML); projectDS.setOperationBindings(fetchBinding); projectDS.setDataURL("Project.xml"); projectDS.setClientOnly(true); DataSourceField idField = new DataSourceField(); idField.setType(FieldType.SEQUENCE); idField.setName("id"); idField.setPrimaryKey(true); idField.setHidden(true); DataSourceTextField codeField = new DataSourceTextField(); codeField.setName("code"); DataSourceTextField managerField = new DataSourceTextField(); managerField.setName("manager_code"); managerField.setCanEdit(false); managerField.setValueXPath("manager/code"); projectDS.setFields(idField, codeField, managerField); FilterBuilder fb = new FilterBuilder(); fb.setDataSource(projectDS); AdvancedCriteria criteria = new AdvancedCriteria(); criteria.addCriteria("manager_code", OperatorId.ICONTAINS, "B"); fb.setCriteria(criteria); ListGrid lg = new ListGrid(); lg.setAutoFetchData(false); lg.setShowFilterEditor(true); lg.setDataSource(projectDS); VLayout main = new VLayout(); main.setHeight100(); main.setWidth100(); main.addMembers(fb, lg); main.draw(); lg.filterData(fb.getCriteria()); SC.logWarn(JSON.encode(lg.getCriteria().getJsObj())); Record record = new Record(); record.setAttribute("id", 99999); record.setAttribute("code", "r/16/2"); record.setAttribute("manager_code", "Black"); projectDS.addData(record); } }
<response> <requestId>Project_request5</requestId> <startRow>0</startRow> <endRow>1</endRow> <totalRows>2</totalRows> <data> <Project> <id>34872</id> <code>r/16</code> <description>fixing</description> <validFrom>2016-04-10T12:00:00Z</validFrom> <validTo>2016-10-07T12:00:00Z</validTo> <manager> <id>1</id> <code>Smith</code> </manager> </Project> <Project> <id>36548</id> <code>r/16/1</code> <description>testing</description> <validFrom>2016-04-27T12:00:00Z</validFrom> <validTo>2016-05-27T12:00:00Z</validTo> <manager> <id>2</id> <code>Brown</code> </manager> </Project> </data> <requestedDataSource>Project</requestedDataSource> <status>STATUS_SUCCESS</status> </response>
public native void removeDollarHFromCriteria() /*-{ var prop = "$H"; var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()(); if (self.data && self.data.getCriteria) { var crit = self.data.getCriteria(); delete crit[prop]; } }-*/;
Comment