This is a migrated thread and some comments may be shown as answers.

conditional template versus function call

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bryan
Top achievements
Rank 1
Bryan asked on 02 Jun 2015, 06:30 PM

I have a column template set up to call a function like so:

 template: "<a onclick='Jump(${A}, \"${B}\");'>${C}</a>"

I want the cell to be empty (since I'm using a tooltip on the column as well and filtering out the empty cells), so I'm changing to a function call:

 template: "#= getGridJump(A,C,B) #"

 Where:

function getGridJump (A, C, B) {
    if (B=== null) {
        return ''
    } else {
        return '<a onclick="Jump(' + A+ ', "' + B + '");">' + C+ '</a>'
    }
}

I can see the correct values in the cell, but there's an additional space between the second argument that isn't there in the original template and the function does not fire. Am I missing some formatting on the return value?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Bryan
Top achievements
Rank 1
answered on 02 Jun 2015, 06:56 PM

Never mind. 

 return "<a onclick='Jump(" + A+ ", \"" + B + "\");'>" + C+ "</a>"

Fixes my issue. 

 

Tags
Grid
Asked by
Bryan
Top achievements
Rank 1
Answers by
Bryan
Top achievements
Rank 1
Share this question
or