Hello, we are trying to apply a client-side filter based on a custom formula and it appears to not work. This is a time sensitive production issue for us so hoping to figure this out as soon as possible.
Use this example in the Feature Explorer:
http://www.smartclient.com/docs/10.0/a/system/reference/SmartClient_Explorer.html#filterBuilderBracket
Use the code below.
1. Right-click on Grid Header > Add Formula Column
2. Create Formula and Save
3. Click "Recreate Advanced Filter" button at bottom. This will add the formula field to the world datasource and add it to the Filter Builder.
4. Enter a filter clause that should filter based on the formula you created and click Filter.
5. It doesn't filter by the formula. If you use other fields, filtering working fine though.
Am I doing something wrong configuring this example or is there a bug?
Use this example in the Feature Explorer:
http://www.smartclient.com/docs/10.0/a/system/reference/SmartClient_Explorer.html#filterBuilderBracket
Use the code below.
1. Right-click on Grid Header > Add Formula Column
2. Create Formula and Save
3. Click "Recreate Advanced Filter" button at bottom. This will add the formula field to the world datasource and add it to the Filter Builder.
4. Enter a filter clause that should filter based on the formula you created and click Filter.
5. It doesn't filter by the formula. If you use other fields, filtering working fine though.
Am I doing something wrong configuring this example or is there a bug?
Code:
isc.FilterBuilder.create({ ID: "advancedFilter", dataSource: "worldDS", criteria: { _constructor: "AdvancedCriteria", operator: "and", criteria: [] } }); isc.ListGrid.create({ ID: "countryList", width: 550, height: 224, alternateRecordStyles: true, dataSource: worldDS, canAddFormulaFields: true, fields: [{ name: "countryName" }, { name: "continent" }, { name: "population" }, { name: "area" }, { name: "gdp" }, { name: "independence" }] }) isc.IButton.create({ ID: "filterButton", title: "Filter", click: function() { countryList.filterData(advancedFilter.getCriteria()); } }) isc.IButton.create({ ID: "filterButton2", title: "Recreate Advanced Filter", top: 400, width: 200, click: function() { var gridFields = countryList.getAllFields(); for (var k = 0; k < gridFields.length; k++) { var field = gridFields[k]; if (field != null && field.userFormula != null) { worldDS.fields[field.name] = field; console.log("adding formula field to datasource" ); } } var testData = []; for (var i = 0; i <= gridFields.length; i++) { var field = gridFields[i]; if (field != null) { var testField = {}; testField.name = field.name; testField.title = field.title; testField.type = field.type; testData[i] = testField; } } isc.DataSource.create({ ID: "bigFilterDS", clientOnly: true, fields: [{ name: "name", type: "text" }, { name: "title", type: "text" }, { name: "type", type: "text" }], testData: testData }); isc.FilterBuilder.create({ ID: "advancedFilter", fieldDataSource: "bigFilterDS", criteria: { _constructor: "AdvancedCriteria", operator: "and", criteria: [] } }); filterVStack.addMember(advancedFilter, 0); } }) isc.VStack.create({ ID: "filterVStack", membersMargin: 10, members: [advancedFilter, filterButton, countryList] }) // Perform the initial filter filterButton.click();
Comment