Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    10.1p, 11.1d: Grouping summaries bug when using custom getGroupTitle

    Hi Isomorphic,

    I noticed this bug in my Application in SmartGWT 5.1p and 6.1p. I managed to reproduce in SmartClient 10.1p (v10.1p_2017-04-15) and 11.1d (SNAPSHOT_v11.1d_2017-04-16) in GC57 and FF26. Please see this showcase sample and modify it as follows:
    Code:
    isc.ListGrid.create({
        ID: "companyList",
        width:600, height:520,
        alternateRecordStyles:true,
        autoFetchData:true,
        dataSource:orderItemLocalDS,
        showAllRecords:true,
        canMultiGroup:true,
        groupByField:["category", "shipDate"],
        groupStartOpen:"all",
        canEdit:true, editEvent:"click",
        
        showGridSummary:true,
        showGroupSummary:true,
        fields:[
            {name:"orderID", includeInRecordSummary:false, summaryFunction:"count"},
            {name:"itemDescription"},
            {name:"category", showGridSummary:true, 
                getGridSummary:function (records, summaryField) {
                    var seenCategories = {};
                    for (var i = 0; i < records.length; i++) {
                        seenCategories[records[i].category] = true;
                    }
                    var totalCategories = isc.getKeys(seenCategories).length;
                    return totalCategories + " Categories";
                    
                },
                getGroupTitle : function (groupValue, groupNode, field, fieldName, grid) {
                    return "groupValue: " + groupValue;
                }
    
            },
            {name:"shipDate", showGroupSummary:true, showGridSummary:false, summaryFunction:"max", groupingMode:"monthAndYear"},
            
            {name:"quantity", showGroupSummary:false, showGridSummary:false},
            {name:"unitPrice", showGroupSummary:false, showGridSummary:false,
             formatCellValue:function (value) {
                 if (isc.isA.Number(value)) {
                    return value.toCurrencyString("$");
                 }
                 return value;
             }
            },
            {name:"Total", type:"summary", recordSummaryFunction:"multiplier",
             summaryFunction:"sum",
             showGridSummary:true, showGroupSummary:true,
             align:"right",
             formatCellValue:function (value) {
                 if (isc.isA.Number(value)) {
                    return value.toCurrencyString("$");
                 }
                 return value;
             }
            }
        ]
    })
    I modified the groupByField (two fields now), canMultiGroup:true and added a getGroupTitle for the category-field.

    If you start the sample, open the MultiGroupDialog and change the order of the two groupBy-fields, you'll get this unexpected result:
    Click image for larger version

Name:	grouping.png
Views:	167
Size:	23.9 KB
ID:	244138


    Some points to notice:
    • This does not happen if you start with groupByField:["shipDate", "category"] (then you'd have to change the order twice to provoke the issue).
    • This does not happen if you remove the getGroupTitle-function or just do return groupValue;
    • This does not happen if you just group by category.
    • -> It seems to be "2nd level grouping with a getGroupTitle defined"-related.
    Best regards
    Blama

    #2
    This has been fixed back to SC 9.1p, and the changes should be in the nightly builds dated 2017-04-20 and beyond.
    Last edited by Isomorphic; 19 Apr 2017, 08:50.

    Comment


      #3
      Hi Isomorphic,

      I can see this is fixed using v10.1p_2017-08-15 and v11.1p_2017-08-17.

      Best regards
      Blama

      Best regards
      Blama

      Comment

      Working...
      X