code_junkie

Can you return a String from a summaryObjectFunction

Nov 10th, 2011
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. private function firstValue(itr:IViewCursor,field:String, str:String=null):Object
  2. {
  3. //if(isNaN(itr.current[field])) return 0 //Theory: Only works on Numeric Values?
  4. return itr.current[field]
  5. }
  6.  
  7. (mx:GroupingField name="Offer")
  8. (mx:summaries)
  9. (mx:SummaryRow summaryPlacement="group")
  10. (mx:fields)
  11. (mx:SummaryField dataField="OfferDescription" label="OfferDescription" summaryFunction="firstValue"/)
  12. (mx:SummaryField dataField="OfferID" label="OfferID" summaryFunction="firstValue"/)
  13. (/mx:fields)
  14. (/mx:SummaryRow)
  15. (/mx:summaries)
  16. (/mx:GroupingField)
  17.  
  18. private function getNestedItem(item:Object):Object {
  19.  
  20. try {
  21. if (item.undefined[0]) {
  22. item = getNestedItem(item.undefined[0]);
  23. }
  24. } catch (e:Error) {
  25. // leave item alone
  26. }
  27. return item;
  28. }
  29. private function formatColumn(item:Object, column:AdvancedDataGridColumn):String {
  30.  
  31. var output:String;
  32. // If this is a summary row
  33. if (item.GroupLabel) {
  34.  
  35. item = getNestedItem(item);
  36. }
  37.  
  38. switch (column.dataField) {
  39.  
  40. case 'comment':
  41.  
  42. return item.comment;
  43.  
  44.  
  45. }
  46.  
  47. }
Add Comment
Please, Sign In to add comment