How to render the boolean field

LabKey Support Forum (Inactive)
How to render the boolean field Ben Bimber  2015-04-24 07:55
Status: Closed
 
Hi Feifei,

I think there's another avenue that might help you here. It's not used often, but columns can have a custom onClick handler added through XML. Rather than try to change the URL of this column, you could add some JS code such that when you click the column it will conditionally do whichever behavior is appropriate. Here's a rough example of what it might do:

<column columnName="Id">
    <displayColumnFactory>
        <className>org.labkey.api.data.JavaScriptDisplayColumnFactory</className>
        <properties>
            <!--this is a JS file containing the handler to be called. While you could write the JS code in the onClick handler below, but debugging will be easier if separated-->
            <property name="dependency">myModule/myCode.js</property>
            <!-- this will call your code, passing in the column's value. your handler can take this information and do whatever is appropriate-->
            <property name="javaScriptEvents">onClick="MyModule.onBooleanFieldClick('${FieldNameHere}');"');"</property>
        </properties>
    </displayColumnFactory>
</column>


You could probably also use variations on this to modify the text you display, meaning you dont see a separate SQL statement, and avoid the problems with editability.