Dr. Winston Prakash Ph.D. 

Personal Website

How to Create a Multi-row selectable CheckBox Table

Some Java Studio Creator users have asked in the forum, if it is possible to make the new Table component to behave like a multi column check box. The answer is - yes. The new table component bundled with Creator 2 is a very flexible component and you can easily write some code to make it work as desired above. This is how it looks after deployment. The two selected columns can be deleted by clicking the button delete

Multi-Select ListBox Table

To put this in to work.

  • Add the table component to the designer
  • Add a data provider to the table component
  • Bring up the table layout and add a new column and move it to the top of the list
  • From the component type drop down list select Check Box.

Now the user is having a table with check boxes in the first column. A little effort is need to wire up the checkboxes to do some work.

  •  When the table is added to the designer necessary Java Script is added automatically. User need to make sure the table ID is correctly set in the Java Script
    function initAllRows() {
        var table = document.getElementById("form1:table1");
        table.initAllRows();
    }
  • In the Outline window select the TableColumn with CheckBox and set the following properties in the property sheet
    • selected="checkbox2", where checkbox2 is the ID of the checkbox added
    • onClick=setTimeout('initAllRows()', 0), where initAllRows() is the Java Script function above

Note: Unfortunately, for Creator 2, the design time does not do the above steps automatically for the user. However, I've added this to my task list to implement it for the next release of Creator.