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!

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...