Thursday, November 19, 2009

Check/Select

One of the most power features of Jspx is Table Control. There are two types of Tables

  1. DataTable
    1. Bind directly to DB.
    2. Commits action directly to DB
  2. ListTable
    1. Bind to Collection of Objects.
    2. Commit Changes to Memory Objects.
Inside a Table you may need to show a check box to make the end user able to select some items and then perform some actions on them later. Adding Check box to table is very easy.

                            type="check" checkType="all" />


This will add a new column in the table with check box in the header and a check box in each row. Which enables end user to select different items from the table. In case the user needed to select all the rows, he can simply click on the header check box. Now jspx will automatically disable all the check boxes in the table indicating that the whole rows were selected.

Some people complained about it.  They say that they wanted to selected All then unselect some single rows. This requires changes in the data column command control. As jspx preserves backward compatibility it was required to introduce the new behavior while keeping the old one.  

This was accomplished by the new attribute selectType , this attribute has one of two values:
  1. Select
    1. This is the default value.
    2. It acts the same way as current.
  2. Check
    1. This is the new behavior.
    2. The check boxes in each row will be check and uncheck instead of being disabled.
The HTML will look like this

type="check" checkType="all" selectType="check" />


By this, the old code is maintained and the new feature is supported!







No comments:

Post a Comment