Announcement

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

    Calculating summary row when autoSaveEdits set to false in ListGrid?

    I created a gridSummay for "Quantity"column in listgrid and also I set to listgrid's "autoSaveEdits" property to false . After that I added to new record but newly "Quantity" column value not added to grid summary. I also tested this situation smartclient Grid Summaries example ("https://www.smartclient.com/smartclient/showcase/?id=summaryGrid") but nothing changes.

    When set autoSaveEdits property to true, everthings ok. But I need to set "autoSaveEdits" property to false for bulk operations.

    Code:
    isc.ListGrid.create({
        ID: "companyList",
        width:650, height:520,
        alternateRecordStyles:true,
        autoFetchData:true,
    [B]autoSaveEdits: false, [/B]
        dataSource:orderItemLocalDS,
        showAllRecords:true,
        groupByField:"category", 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";
    
                }
            },
            {name:"shipDate", showGroupSummary:true, showGridSummary:false, summaryFunction:"max"},
    
            {name:"quantity", showGroupSummary:false,[B] showGridSummary:true[/B]},
            {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;
             }
            }
        ]
    });
    
    /[B]/*****************Our Code *******************************
    isc.IButton.create({
        ID:"newRecord",
        title: "New",
        click: function () {
               companyList.startEditingNew();
              }
    });
    
    isc.VLayout.create({
       ID: "layout",
       padding: 5,
       members: [companyList, newRecord]
    });
    
    //*****************Our Code *******************************[/B]



    Click image for larger version

Name:	Screenshot_1.png
Views:	42
Size:	101.5 KB
ID:	251294

    Attached Files

    #2
    Dear smartclient admistrators,

    Could you have any suggestions for previous post?

    Comment


      #3
      This was a limitation affecting only summary calculations of unsaved, newly added rows. It should be fixed in SmartClient 10.1p and newer releases in the nightly builds dated 2018-01-22 and beyond.

      Comment

      Working...
      X