• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Custom Summary Row

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Summary Row

    I have made a Valence CNX App with a grid widget that has a summary row.

    In the summary row, I have set the values for Field1 and Field2 to be the summation of all values in their respective columns using the NAB’s built-in summary total feature. But instead of doing the same for Field3 in the summary row, I want the value in Field3 to satisfy this custom equation:

    (The value for Field2 in the summary row) / (The value for Field1 in the summary row) * 1000

    Is there a way that I can make this happen in the current version of Valence CNX?


  • #2
    We don't have an easy way to get the summary values from within a custom formatter and have added this to our feature request list.

    In the meantime if your grid isn't grouping then you could get the summary values with a little code in your columns custom formatter. When the rec parameter is empty then it's being called for the summary cell

    Code:
    // check if this is for the summary "rec param will be empty"
    //
    if (Valence.isEmpty(rec)) {
        // get the summary values
        //
        var reader = grid.getStore().getProxy().getReader(),
            resp   = (!Valence.isEmpty(reader)) ? reader.rawData : null;
    
        if (!Valence.isEmpty(resp) && !Valence.isEmpty(resp.sum)) {
            // get my other field's summary value "CYTDSALES"
            //
            var sales = resp.sum[0].CYTDSALES;
            return sales / 1000 + v;
        }
    }
    
    return v;

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X