Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82668

Condition in rowGroup

$
0
0

Hi guys
I implemented some conditions in the rowGroup function and I wanted to add another condition (I'm using improvised code, it's just to let you understand what I want to do):

these are the existing conditions already working:

    rowGroup: {
        endRender: function ( rows, group, row ) {
                var controllo = '';

                var intVal = function ( i ) {
                        return typeof i === 'string' ?
                                i.replace(/[\$,]/g, '')*1 :
                                typeof i === 'number' ?
                                        i : 0;
                                    };

            var epalcount = rows
                .data()
                .pluck('epal')
                .reduce( function (a, b) {
                    return intVal(a) + intVal(b);
                }, 0) ;

                            var indcount = rows
                                    .data()
                                    .pluck('ind')
                                    .reduce( function (a, b) {
                                            return intVal(a) + intVal(b);
                                    }, 0) ;

                                    var perdcount = rows
                                            .data()
                                            .pluck('perd')
                                            .reduce( function (a, b) {
                                                    return intVal(a) + intVal(b);
                                            }, 0) ;

                                            var epcount = (epalcount + perdcount);

                                    if(epcount == 33 && indcount == 0|| epcount == 28 && indcount == 4)
                                    {
                                     var controllo = "CAMION PIENO";
                
                                 }
                                 else if(epcount >= 33 && indcount >0 || indcount > 4 || epcount > 33){
                                    var controllo = "CONTROLLA I BANCALI";
                                 }
                                 else{
                                     var controllo = "CAMION VUOTO";
                                 };



    



            return $('<tr/>')
                    .append( '<td></td>' )
                    .append( '<td></td>' )
                    .append( '<td></td>' )
                    .append( '<td></td>' )
                    .append( '<td></td>' )
                                    .append( '<td >'+epcount+'</td>' )
                    .append( '<td>'+indcount+'</td>' )
                    .append( '<td>'+controllo+'</td>' )
                    .append( '<td></td>' )
                        .append( '<td></td>' );
        },
        dataSrc: function (data) {
        return data.dlinea;
      }
    },

I would like that when the variable :
var controllo = "CAMION PIENO"
the endRender line is highlighted

this is improvised javascript code:

if(var controllo = "CAMION PIENO")
{
   $(td).addclass(myHighlight);
}

this is the output than i've now:

this is the output than i want 've:

I hope I made myself clear, excuse the length of the topic.


Viewing all articles
Browse latest Browse all 82668

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>