SmartGWT 4.0-2013-11-30
FF 19
Problem:
When creating a ListGridField with a CellFormatter and a SummaryFunction, the CellFormatter is invoked for all cells and, at the end, for the group cell. I am observing the following:
1. The CellFormatter.format () value parameter contains the HTML returned by the SummaryFunction - seems reasonable
2. On the group cell call, rowNum is 0, and colNum is 6 (in my case). This does not seem reasonable because I cannot tell whether the invocation is for row 0 or the group row.
So I looked around and it seems that the showcase code handles the same problem with a try/catch:
Sample code:
https://code.google.com/p/smartgwt/s...le.java?r=1857
Questions:
1. Is there a way to handle this cleanly, other than a try/catch?
2. When CellFormatter.format () is invoked for the group cell call, is there a way to know that it is a group cell and not a regular cell?
Thanks.
FF 19
Problem:
When creating a ListGridField with a CellFormatter and a SummaryFunction, the CellFormatter is invoked for all cells and, at the end, for the group cell. I am observing the following:
1. The CellFormatter.format () value parameter contains the HTML returned by the SummaryFunction - seems reasonable
2. On the group cell call, rowNum is 0, and colNum is 6 (in my case). This does not seem reasonable because I cannot tell whether the invocation is for row 0 or the group row.
So I looked around and it seems that the showcase code handles the same problem with a try/catch:
Sample code:
https://code.google.com/p/smartgwt/s...le.java?r=1857
Code:
ListGridField unitPriceField = new ListGridField("unitPrice"); unitPriceField.setAlign(Alignment.RIGHT); unitPriceField.setCellFormatter(new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) return null; try { NumberFormat nf = NumberFormat.getFormat("#,##0.00"); return "$" + nf.format(((Number) value).doubleValue()); } catch (Exception e) { return value.toString(); } } }); unitPriceField.setShowGroupSummary(false); unitPriceField.setShowGridSummary(false);
1. Is there a way to handle this cleanly, other than a try/catch?
2. When CellFormatter.format () is invoked for the group cell call, is there a way to know that it is a group cell and not a regular cell?
Thanks.