KX Community

Find answers, ask questions, and connect with our KX Community around the world.

Home Forums kdb+ Column of boolean values not converting to checkboxes within a Data Grid

  • Column of boolean values not converting to checkboxes within a Data Grid

    Posted by vice-freak on February 2, 2024 at 12:00 am

    Hi all,

     

    Apologies for the novice question, I have a data grid where three columns all take on the boolean type (i.e. true, false) but for whatever reason I am unable to convert them into checkboxes that are either ticked (true) or unticked (false).

     

    In the ‘Columns’ section of the Data Grid, I changed the ‘Format’ attribute to boolean, but my data still appears as ‘true’ and ‘false’. Is there a setting that needs to be switched on or something that I have missed preventing me from attaining what I am after?

    vice-freak replied 2 months, 2 weeks ago 3 Members · 3 Replies
  • 3 Replies
  • jlucid

    Member
    February 7, 2024 at 12:00 am

    I think you need the Edit Mode to be set to instant for those click boxes to appear. See edit mode section here.

     

    https://code.kx.com/dashboards/datagrid/

  • ivankk

    Member
    February 16, 2024 at 12:00 am

    Checkboxes can be rendered by configuring “Columns > Column x > Template”.
    Once in template editor, you have to switch to “Advanced mode” and use Handlebars template to render the content, you can try this:

    {{#if thisRawValue}} <i class="mi mi-check-box" style="color: #38a338"></i> {{else}} <i class="mi mi-check-box-outline-blank" style="color: #c0c0c0"></i> {{/if}}

    This example uses material icons, you can also use font-awesome icons as both are supported.

     

     

     

  • vice-freak

    Member
    February 18, 2024 at 12:00 am

    Perfect solution, thank you kindly ivankk.

     

    For anyone reading this in the future, who would like to have green ticks and red crosses, please view the (slightly altered) code below:

    {{#if thisRawValue}}

    <i class=”fa fa-check” style=”color: #00c000″></i>

    {{else}}

    <i class=”fa fa-times” style=”color: #c00000″></i>

    {{/if}}

Log in to reply.