rowGroup startRender using level augment

rowGroup startRender using level augment

bbrindzabbrindza Posts: 123Questions: 26Answers: 1

I need to get the row count for the second level rowGroup using the new level augment in version 1.10. I could not find any examples on how to use this on the web or on DataTables site.

   rowGroup: {
               dataSrc: [ 'time_log_year', 'employee_full_name'],
               startRender: function ( rows, group, level ) {
                    return group +' ('+rows.count()+' rows)';
                } 
    },

I also need to count all rows for the second level not just for each page. (see images below)

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 9,769Questions: 25Answers: 2,255

    Need to remove this group count for rows

    The rowGroup.startRender docs state the level parameter is used to indicate the group level with the first level being 0. An if statement can be used to return different strings.

    also need to count all rows for the second level not just for each page.

    The example in this thread shows one way to sum the group's total across multiple pages. You should be able to use the same technique to get the row count.

    Kevin

  • bbrindzabbrindza Posts: 123Questions: 26Answers: 1

    Kevin, I did seen the document regarding the level argument , however I am trying to figure out how to use this in my startRender function.

    What is the syntax?

  • kthorngrenkthorngren Posts: 9,769Questions: 25Answers: 2,255
    Answer ✓

    Didn't test it but something like this:

    rowGroup: {
                dataSrc: [ 'time_log_year', 'employee_full_name'],
                startRender: function ( rows, group, level ) {
                     if ( level == 0 ) {
                       return group;
                     } else {
                       return group +' ('+rows.count()+' rows)';
                     }
                 }
     },
    

    Kevin

  • bbrindzabbrindza Posts: 123Questions: 26Answers: 1

    That what I was looking for .
    Thank You Kevin! :)

Sign In or Register to comment.