Announcement

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

    ListGrid showGridSummary

    Is this functionality limited to grids that have all the records showing? I'm trying to determine why it doesn't show for one of my listgrids and the only difference I see is that the other grids that are working have all the data displayed whereas this one only has a subset of the total data.

    #2
    Yes - you can't calculate a sum with only part of the data.

    There is the summaryRowDataSource if you want to be able to provide sums for larger datasets via a server call.

    Comment


      #3
      Ok. But this summaryRowDataSource does a second call to the server right?

      I'd like to be able to send the summary data as well as the actual data at once and provide a custom function for summaryFunction which will have the logic to retrieve this summary data. - or will this just bring me back to the original issue with summaryFunction only being called when all data is present?

      Comment


        #4
        If your concern is with avoiding an extra round-trip, the fetch against the summaryRowDataSource is queued along with the data fetch itself, so there's only one server trip.

        Comment


          #5
          Ah, ok. Thanks. I will try that approach

          Comment


            #6
            When using Summary Function "Avg" , is there any way to limit the precision to maybe just 2 digits after the decimal? Right now the value is showing a really long decimal number.

            Comment


              #7
              Another question:

              I noticed then when I have a boolean column and I want to display the summary under it as "count", it doesn't show. Is this expected behaviour?

              Code:
              isc.ListGrid.create({
                  ID: "countryList",showGridSummary: true,
                  width:550, height:224, alternateRecordStyles:true, cellHeight:22,
                  // use server-side dataSource so edits are retained across page transitions
                  dataSource: countryDS,
                  // display a subset of fields from the datasource
                  fields:[
                      {name:"countryCode", title:"Flag", width:40, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png", canEdit:false},
                      {name:"countryName"},
                      {name:"continent"},
                      {name:"member_g8", summaryFunction:"count",
                       showGridSummary:true},
                      {name:"population", formatCellValue:"isc.Format.toUSString(value);"},
                      {name:"independence"}
                  ],
                  autoFetchData: true,
                  canEdit: true,
                  editEvent: "click"
              })

              Comment


                #8
                On formatting the Avg value - you should be able to use ListGridField.formatGridSummary() to convert the caculated value to a nicer user-visible string.

                On showing the count value for a boolean field - yes this should be supported. We're looking into how to get this working for you.

                Comment


                  #9
                  We've made a change to suppress the checkbox images for boolean fields in the summary row. This should show up in the next nightly build (dated March 24 or higher)

                  Comment


                    #10
                    Thanks. Found another problem:

                    I have a column called "Quantity" and I've set showGroupSummary to true, summaryFunction to "count". I did not set a pluralTitle in the data source. I would assume that the summary title would come from the Quantity column's title as this is the behaviour for grid summaries but instead it takes the last column's title, in this case "TOTAL".

                    Code:
                    isc.ListGrid.create({
                        ID: "companyList",
                        width:600, height:520,
                        alternateRecordStyles:true,
                        autoFetchData:true,
                        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:true, showGridSummary:true, summaryFunction: "count"},
                            {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",title:"TOTAL",
                             showGridSummary:false, showGroupSummary:false,
                             align:"right",
                             formatCellValue:function (value) {
                                 if (isc.isA.Number(value)) {
                                    return value.toCurrencyString("$");
                                 }
                                 return value;
                             }
                            }
                        ]
                    })
                    data:

                    Code:
                    var testData = [
                    {pk:0, orderID:8805, itemDescription:"Anti Virus Suite",
                        category:"Software", shipDate:new Date(2009,10,20), quantity:2 , unitPrice:50 },
                    {pk:1, orderID:4833, itemDescription:"USB Ergonomic Keyboard",
                        category:"Hardware", shipDate:new Date(2009,10,13), quantity:1 , unitPrice:99.99 },
                    {pk:2, orderID:9551, itemDescription:"Lumbar Support Cushion",
                        category:"Hardware", shipDate:new Date(2010,1,2), quantity:1 , unitPrice:75 },
                    {pk:3, orderID:954, itemDescription:"USB Keyboard",
                        category:"Hardware", shipDate:new Date(2009,10,20), quantity:12 , unitPrice:34.99 },
                    {pk:4, orderID:616, itemDescription:"Consulting Services",
                        category:"Services", shipDate:new Date(2009,10,10), quantity:40 , unitPrice:100 },
                    {pk:5, orderID:8357, itemDescription:"Office Application Suite",
                        category:"Software", shipDate:new Date(2010,2,5), quantity:14 , unitPrice:30 },
                    {pk:6, orderID:4582, itemDescription:"Anti Virus Suite",
                        category:"Software", shipDate:new Date(2010,1,20), quantity:22 , unitPrice:50 },
                    {pk:7, orderID:9373, itemDescription:"On-site Training",
                        category:"Services", shipDate:new Date(2009,10,20), quantity:20 , unitPrice:100 },
                    {pk:8, orderID:9311, itemDescription:"Software Development Kit",
                        category:"Software", shipDate:new Date(2009,10,10), quantity:8 , unitPrice:249.99 },
                    {pk:9, orderID:7806, itemDescription:"15 inch flat panel monitor",
                        category:"Hardware", shipDate:new Date(2009,11,12), quantity:4 , unitPrice:300 },
                    {pk:10, orderID:8620, itemDescription:"18 inch flat panel monitor",
                        category:"Hardware", shipDate:new Date(2009,11,11), quantity:2 , unitPrice:375 },
                    {pk:11, orderID:629, itemDescription:"Office Productivity Suite", 
                        category:"Software", shipDate:new Date(2009,12,10), quantity:15 , unitPrice:64.99 },
                    {pk:12, orderID:1264, itemDescription:"Office Productivity Suite",
                        category:"Software", shipDate:new Date(2009,12,20), quantity:2 , unitPrice:64.99 },
                    {pk:13, orderID:7100, itemDescription:"USB Ergonomic Keyboard",
                        category:"Hardware", shipDate:new Date(2009,10,20), quantity:6 , unitPrice:99.99 },
                    {pk:14, orderID:9647, itemDescription:"Consulting Services",
                        category:"Services", shipDate:new Date(2009,12,21), quantity:10 , unitPrice:100 },
                    {pk:15, orderID:8468, itemDescription:"USB Optical Mouse",
                        category:"Hardware", shipDate:new Date(2009,10,10), quantity:5 , unitPrice:29.99 },
                    {pk:16, orderID:9496, itemDescription:"Off-site Training",
                        category:"Services", shipDate:new Date(2010,1,1), quantity:35 , unitPrice:80 },
                    {pk:17, orderID:5124, itemDescription:"USB Stereo Headset",
                        category:"Hardware", shipDate:new Date(2009,10,20), quantity:1 , unitPrice:69.99 },
                    {pk:18, orderID:1799, itemDescription:"Office Application Suite",
                        category:"Software", shipDate:new Date(2009,11,2), quantity:22 , unitPrice:30 },
                    {pk:19, orderID:7020, itemDescription:"Consulting Services",
                        category:"Services", shipDate:new Date(2009,12,20), quantity:100 , unitPrice:80 }
                    ];
                    
                    isc.DataSource.create({
                        ID:"orderItemLocalDS",
                        clientOnly:true,
                        testData:testData,
                        fields:[
                            {name:"pk", type:"sequence", primaryKey:"true", hidden:"true"},
                            {name:"orderID", type:"integer", canEdit:false, title:"Order ID", pluralTitle:"Orders"},
                            {name:"itemDescription", type:"text", title:"Description"},
                            {name:"category", type:"text", title:"Category"},
                            {name:"shipDate", type:"date", title:"Ship Date"},
                            {name:"quantity", type:"integer", title:"Quantity"},
                            {name:"unitPrice", type:"float", title:"Price"}
                        ]
                    });

                    Comment


                      #11
                      We're not seeing this behavior (tested by copying and pasting your code into the Grid Summaries example in the feature explorer).

                      Its not clear what could be going wrong - nothing in our code should be causing us to pick up the title from a different field. Are you absolutely sure that the DataSource you're loading doesn't have that property set on the quantity field as either title or pluralTitle?

                      Comment


                        #12
                        That code I used is actually from feature explorer:
                        http://localhost:8777/isomorphic/system/reference/SmartClient_Explorer.html#summaryGrid

                        I didn't change the data source because the feature explorer does not allow me to. The following is what I changed in the example:

                        1. Change this code:

                        {name:"quantity", showGroupSummary:false, showGridSummary:false},

                        to this:

                        {name:"quantity", showGroupSummary:true, showGridSummary:true, summaryFunction: "count"},

                        2. Add a title to the last column:

                        {name:"Total", type:"summary", title: "TOTAL LABEL FOR TOTAL COLUMN",recordSummaryFunction:"multiplier",
                        summaryFunction:"sum",
                        showGridSummary:true, showGroupSummary:true,
                        align:"right",
                        formatCellValue:function (value) {
                        if (isc.isA.Number(value)) {
                        return value.toCurrencyString("$");
                        }
                        return value;
                        }

                        Version:
                        SmartClient Version: SC_SNAPSHOT-2010-12-15/PowerEdition Development Only (built 2010-12-15)

                        Reproduceable: Firefox 4.0, Chrome, IE9

                        Comment


                          #13
                          Just tried with the online feature explorer and the exact same thing happens.

                          Comment


                            #14
                            Ah - we see this with the online showcase but not with the latest nightly build (actually testing with the build from 03/26).

                            Can you upgrade to the latest nightly build? It should resolve this issue for you.

                            Comment


                              #15
                              I get lots of errors in the latest build when I try to open either the feature explorer or the documentation.

                              Code:
                              missing ) after condition
                              [Break On This Error] {_11=_11.valueOf();_13=false}
                              ISC_Fo...3-29.js (line 763)
                              isc.TreeSearch.getPrototype is not a function
                              [Break On This Error] );isc.B._maxIndex=isc.C+1;isc.defineCl...Grid)this.setTreeGrid(this.treeGrid)}
                              ISC_Ex...3-29.js (line 177)
                              GET http://localhost:8777/isomorphic/skins/Enterprise/load_skin.js?isc_version=SC_SNAPSHOT-2011-03-29.js
                              	
                              200 OK
                              		6ms	
                              firebu...rver.js (line 169)
                              <System>
                              _11.createRaw is not a function
                              [Break On This Error] _5=this.applyDuplicateAutoChildDefault...his[_16]!==_15){_12[_16]=this[_16]}}}
                              ISC_Co...3-29.js (line 438)
                              Issues with trunk Firefox for Firebug: http://getfirebug.com/knownissues

                              Comment

                              Working...
                              X