I'm using the jqGrid plugin for jQuery.
In the jqGrid function, I want to pass in a value for the width, but I want to pass in the value depending on the outcome of a method in my controller.
Controller
public Boolean isTest{
get{
String userAgent = System.currentPageReference().getHeaders().get('User-Agent');
return userAgent.contains('test');
}
}
JS
jQuery("#INFO").jqGrid(
{
height: 265,
sortable: true,
multiselect: false,
viewrecords: true,
rowNum: mySelectedRowNum,
width:'{!isTest}' ? pageWidth - 25 : 300,
});
At the moment, it's returning true, even when it should be returning false. I use this method in a few different places and it works properly, this is the first time I have used it in a ternary operator though.
Is my implementation wrong somewhere here?