Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

Get max value of column with mRender

$
0
0
For each cell in one of the table's columns, I need to compare the value to the maximum value in the column, and add a style based on that. The table is being built from some JSON data.

I'm using mRender to handle the styling, but I can figure out how to get the max value of the column. I was using the following:

                    'mRender': function ( data, type, full ) {
                        if ( type === 'display' ) {
                            var maxV = Array.max(full[1])*1.05;
                            return makeBar(data, maxV);
                        }else{
                            return data;
                        }
                    }


Array.max is expecting an array of data for the column:
 

Array.max = function( array ){
    return Math.max.apply( Math, array );
};


but I realize that 'full' only grabs the data for a single row.

How do I get an array of data for a single column?

Thanks!

Viewing all articles
Browse latest Browse all 1816

Trending Articles