All Apps and Add-ons

how can i return a multivalued content using table-cell-highlighting ?

sfatnass
Contributor

hi,

i use tabe-cell-highlighting to color some value.

but if i have a multivalued content
how can i return this as multivalued content or an array and.

     if (cell.field === 'myMultivalued'){
            var valueDx = String(cell.value)
            var separators = [ '\\,' ];
            var tokens = valueDx.split(new RegExp(separators.join('|'), 'g'));

            for(var i =0; i<tokens.length;i++){
                    var numbers = parseFloat(tokens[i].split(":")[1]);
                if(numbers <= 0.2){
                    $td.addClass('range-cell').addClass('range-severe');
                    break;
                }
            }

            $td.text(cell.value);
        }

this is the line to modify : $td.text(cell.value);

i tryed something like that : $td.array(cell.value); but it's wrong and i know it.

in the same way can i keep the original content after highlighting ?

thx

0 Karma
1 Solution

sfatnass
Contributor

i solved it with that:

 if (cell.field === 's_conDx'){
            var valueDx = String(cell.value)
            var html_content= "";
            var tokens =[];
            var separators = [ '\\,' ];    
            tokens = valueDx.split(new RegExp(separators.join('|'), 'g'));
            for(var i =0; i<tokens.length;i++){
                var numbers = parseFloat(tokens[i].split(":")[1]);
                                        if(numbers <= criticalval){
                            html_content = html_content+"<div tabindex=\"0\" class=\"multivalue-subcell\" style=\"color:#E80C0C;\" data-mv-index=\""+i+"\">"+tokens[i]+"</div>";
                                }else{
                                html_content = html_content+"<div tabindex=\"0\" class=\"multivalue-subcell\" data-mv-index=\""+i+"\">"+tokens[i]+"</div>";
                                }
                            }
                        $td.html(html_content).addClass('string');
                    }

View solution in original post

0 Karma

sfatnass
Contributor

i solved it with that:

 if (cell.field === 's_conDx'){
            var valueDx = String(cell.value)
            var html_content= "";
            var tokens =[];
            var separators = [ '\\,' ];    
            tokens = valueDx.split(new RegExp(separators.join('|'), 'g'));
            for(var i =0; i<tokens.length;i++){
                var numbers = parseFloat(tokens[i].split(":")[1]);
                                        if(numbers <= criticalval){
                            html_content = html_content+"<div tabindex=\"0\" class=\"multivalue-subcell\" style=\"color:#E80C0C;\" data-mv-index=\""+i+"\">"+tokens[i]+"</div>";
                                }else{
                                html_content = html_content+"<div tabindex=\"0\" class=\"multivalue-subcell\" data-mv-index=\""+i+"\">"+tokens[i]+"</div>";
                                }
                            }
                        $td.html(html_content).addClass('string');
                    }
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...