Datatable column template - how to use dynamic function

Hi,
Exist way to use dynamically function names in templates ?

I want to render some columns with image - it’s very simple red/green/yellow gifs, inform about situation.

I tried that :

        grid.columns[ c ].template = function( obj )
        {
           let ci = 'mat_wrtoff' // mine column id at this moment 
           let val = obj[ ci ] 
           let clr = 'green' 
           if ( val == 'N' )
              clr = 'red'
           if ( val == 'G' )
              clr = 'yellow'  
           return '<img src="imgs/' + clr + '.gif"/>'
        }

It’s working . But I wanna to do like something that :

        grid.columns[ c ].template = function( obj )
        {
           return window[ mineFunctionName ]( obj )
        }

Sorry, but that isn’t working … :frowning:

Maybe exist another solution for that, but I didn’t found info …

In the outside function the same as in first template source …

Thanks in advance…

Found another solution for that … :slight_smile:

Did array like :
[ { id: “N”, text: ’ img src=“imgs/red.gif”/ ’ }, { id: ‘T’, text: ’ img src=“imgs/green.gif”/ ’ } ]
remove >< for this message view …

And stick it as collection … it’s working :slight_smile:

But anyway - leave previuos question about dynamic function use ( not necessarily for templates ) opened. I think that will be needful …