How to use EditorDataTables with rowGroup

How to use EditorDataTables with rowGroup

reru.academic1reru.academic1 Posts: 10Questions: 2Answers: 0

How to use Group and summary rowgroup

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    The examples here show how to use the RowGroup extension for DataTables. What have you tried? What problem(s) have you run into?

    Allan

  • reru.academic1reru.academic1 Posts: 10Questions: 2Answers: 0
    edited June 13
    rowGroup: {
            endRender: function ( rows, group ) {
                    var intVal = function (i) {
                    return typeof i === 'string' ? i.replace(/[\$,]/g, '') * 1 : typeof i === 'number' ? i : 0;
                };
    
                    var a = rows                    
                        .data()
                        //.pluck(5)
                        .column(5)
                        .reduce( function (a, b) {
                            return intVal(a)+intVal(b);
                        }, 0);
    
                    var b = rows
                    .data()
                    //.pluck(6)
                    .column(6)
                    .reduce( function (a, b) {
                        return intVal(a)+intVal(b);
                    }, 0);
    
                    var c = rows
                        .data()
                        //.pluck(7)
                        .column(7)
                        .reduce( function (a, b) {
                            return intVal(a)+intVal(b);
                        }, 0);
                        return '<tr class="group"><td colspan="9"> A = '+ a +' B = '+ b +' C = '+ c +'</td></tr>';
    
                },
                dataSrc: 'TERM'
            }
    
    //output  data   a b c = 0  
    
  • reru.academic1reru.academic1 Posts: 10Questions: 2Answers: 0

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    I'm not clear on what the problem is. What are you expecting? Also can you link to a page showing tie issue please?

    Allan

Sign In or Register to comment.