Dear Isomorphics!
I'm facing issues with calculated text fields as the summary functions don't work as expected
1. I'm working with:
• SmartGWT 6.1
• built-in-ds (from SGWT)
• JDK 1.8.0_241
• GWT Eclipse Plugin 2.8.1
• Eclipse 2020-03 (4.15.0) Build id: 20200313-1211
2. Attached to this post are the files I used for showing the scenario and reproduce the issue:
• BuiltInDS.gwt.xml
• BuiltInDS.html
• buffers.data.xml
• BuiltInDS.java
3. I tried to use summary functions from a context menu, such as Count, Min, Max, Avg, and show result in group header for each field.
• This is the way I added the UserSummary field:
• And this is the code for setting the summary function:
4. The video below shows the behavior:
Would you please help me with any approach to get that functionality working?
Thanks in advance for your support
Best regards,
Oscar Londoņo
I'm facing issues with calculated text fields as the summary functions don't work as expected
1. I'm working with:
• SmartGWT 6.1
• built-in-ds (from SGWT)
• JDK 1.8.0_241
• GWT Eclipse Plugin 2.8.1
• Eclipse 2020-03 (4.15.0) Build id: 20200313-1211
2. Attached to this post are the files I used for showing the scenario and reproduce the issue:
• BuiltInDS.gwt.xml
• BuiltInDS.html
• buffers.data.xml
• BuiltInDS.java
3. I tried to use summary functions from a context menu, such as Count, Min, Max, Avg, and show result in group header for each field.
• This is the way I added the UserSummary field:
Code:
Map<String, String> summaryVars = new HashMap<String, String>(); summaryVars.put("A", "Sku"); summaryVars.put("B", "Location"); UserSummary textSummary = new UserSummary("#{A}#{B}", summaryVars); ListGridField summaryText = new ListGridField("summaryField", "Summary Title", 100); summaryText.setCanEdit(false); summaryText.setCanSortClientOnly(true); summaryText.setCanFilter(true); summaryText.setAllowFilterExpressions(true); summaryText.setAllowFilterOperators(true); summaryText.setUserSummary(textSummary); summaryText.setIncludeInRecordSummary(true); summaryText.setType(ListGridFieldType.TEXT); final int fieldPosition = 4; addFieldAtIndex(summaryText, gridExample, fieldPosition);
Code:
getSelectedField().setShowGroupSummary(true); getSelectedField().setIncludeInRecordSummary(true); Boolean isText = getSelectedField().getType().equals(ListGridFieldType.TEXT); if (isText) { getSelectedField().setSummaryFunction(new SummaryFunction() { @Override public Object getSummaryValue(Record[] records, ListGridField field) { String summaryValue = "0"; if (function != null && function.getValue().equals(SummaryFunctionType.COUNT.getValue())) { summaryValue = (records == null) ? "0" : records.length + ""; } return summaryValue; } }); } else { getSelectedField().setSummaryFunction(function); } gridExample.recalculateSummaries();
Would you please help me with any approach to get that functionality working?
Thanks in advance for your support
Best regards,
Oscar Londoņo
Comment