Neil Deakin wrote:

Based on information from Jan Varga, who implemented the changes, here is some information about the changes made recently to the XUL tree widget code as part of bug 221619, which fixes a number of issues with trees. This code was checked in on April 16 and is it builds after that, but not 1.7

--------------------------------------------------------------------------------------------------------------

         CHECKBOX COLUMNS
--------------------------------------------------

Tree columns now implement the 'checkbox' type. Previously the value existed but was not implemented. Now it is. You can create a checkbox column by setting the 'type' attribute of a column to 'checkbox'.

<treecol type="checkbox">

You can then set or clear the checkbox for a particular cell in that column by setting the value attribute to true, or leaving out the attribute. Note that it's the value attribute you use, not the label attribute.

<treecell/>
<treecell value="true"/>

For theme authors, the -moz-tree-checkbox pseudo can be used to specify the checkmark image.

In addition, checkmark columns support editing:

<tree editable="true">
 <treecols>
   <treecol type="checkbox" editable="true">
   ...
</tree>

If the column is editable, the user can click the cell to change the state of the checkbox. When the user clicks the cell, the view's setCellValue method will be called with either the value 'true' or 'false'.

Note that the tree must also be marked as editable using the editable attribute in order for this to work. This is shown in the example above. Sometimes, you might have a particular row or cell which you do not want to be editable. In this case, disable editing for that cell by setting editable to false for that cell, as in the following:

<treecell value="true" editable="false"/>



I've tried using the above checkbox code in production Mozilla 1.7 and Firefox 0.9.1 (for Windows), but for some reason the checkbox does not appear. Does this new checkbox feature work yet in these production versions? The code I'm using follows:

<tree editable="true" flex="1">
  <treecols>
        <treecol type="checkbox" editable="true"/>
        <treecol primary="false" label="" flex="1" id="number"/>
  </treecols>

  <treechildren>
        <treeitem>
          <treerow>
                <treecell value="true"/>
                <treecell label="Label 1"/>
          </treerow>
        </treeitem>
        <treeitem>
          <treerow>
                <treecell value="false"/>
                <treecell label="Label 2"/>
          </treerow>
        </treeitem>
  </treechildren>
</tree>
_______________________________________________
mozilla-documentation mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-documentation

Reply via email to