[CLOSED] CustomSummaryType in grid - regroup in JS

  1. #1

    [CLOSED] CustomSummaryType in grid - regroup in JS

    I have a grid similar to https://examples3.ext.net/#/GridPane...oupingSummary/

    My issue is that i modified my CustomSummaryType to utilize a hidden variable to determine how to summarize.

    The variable is dynamic and i want to change it in JS code. Once i change it, i want tell the grid to rerender the summary totals (without reloading or regrouping).

    However, i do NOT want to commit records to do this. i just need a simple call like grid.getView().refresh() so the summaries will update and retally.

    pls assist.
    Thanks,
    /Z
    Last edited by Daniil; Jan 15, 2016 at 10:13 AM. Reason: [CLOSED]
  2. #2
    Hello @Z!..

    What you mean with NOT want to commit records?

    In the example you pointed I could do, in console:

    var x = var x = App.GridPanel1.store.getAt(2); // get third row
    
    x.set("Rate",50); // change a value inside the grid, programatically.
    
    // At this point, the summary has been updated in the grid, reflecting the new value.
    
    var z = App.GridPanel1.getStore(); // get the grid store's handle
    z.rejectChanges(); // reject the change made above
    
    // at this point, the grid data has returned its original data and summary also updated accordingly.
    Is there a point I'm missing?
    Fabrício Murta
    Developer & Support Expert
  3. #3
    I have 1600 rows and 35 groups. I want to update them all. Hence not wanting to set records.
    /Z
  4. #4
    So, how does this look?

    var store = App.GridPanel1.getStore();
    
    var row0 = store.getAt(0);
    var row1 = store.getAt(1);
    var row2 = store.getAt(2);
    
    row0.data.Rate=100;
    row1.data.Rate=101;
    row2.data.Rate=115;
    
    store.commitChanges();
    This way I see it only updates the summary after I call the commit function. Of course, this is a simplified loopless sample, you can just loop thru getStore().data setting values in batch, then call commitChanges() in the end.
    Fabrício Murta
    Developer & Support Expert
  5. #5
    I tried this and it just hangs the browser so it is not a solution. grid has 1300 rows and uses buffered rendering.
    /Z

            var regroup = function () {
                var store = App.test.getStore();
                
                store.suspendEvents(true);
                store.each(function (record, index) {
                    record.set('updated', counter);
                });
                store.resumeEvents();
                //increment so the next time works
                counter++;
            };
  6. #6
    Well, in this case I believe we would need to have a test case reproducing the issue. Maybe a grid with 1300+ fake records (may be random generated data on a small for loop) and with a mechanism (button maybe) to simulate the slow change you want to do in the grid. And then we can better suggest solutions.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] CustomSummaryType and ColumnName
    By bbros in forum 3.x Legacy Premium Help
    Replies: 9
    Last Post: Aug 18, 2015, 3:18 PM
  2. Replies: 3
    Last Post: Nov 19, 2014, 5:30 AM

Posting Permissions