Compare Revisions

tree

Change Revisions

Revision 72886:

Revision 72886 by Sheppy on

Revision 72887:

Revision 72887 by Fabrejulien on

Title:
tree
tree
Slug:
XUL/tree
XUL/tree
Tags:
"XUL Reference", "XUL Elements"
"XUL Reference", "XUL Elements"
Content:

Revision 72886
Revision 72887
tt201</pre>
202    <p>
203      selecting checked cell on a tree&nbsp;:
204    </p>
205    <p>
206      First a binding Method&nbsp;:
207    </p>
208    <pre>
209      &lt;method name="getCellChecked"&gt;
210        &lt;body&gt;
211        &lt;![CDATA[  
212        var tree=this;
213        var ret='';
214        var col = document.getAnonymousElementByAttribute(this, "
 >type", "checkbox");
215        var Pos= parseInt(col.ordinal/2);
216         for (var i =0; i&lt;tree.view.rowCount;i++){
217                if (tree.view.getCellValue(i, tree.columns.getCol
 >umnAt(Pos))=='true')
218                    ret+=tree.view.getCellText(i, tree.columns.ge
 >tColumnAt(Pos))+' ';
219              }
220              return ret==''?null:ret.substring(0,ret.length-1);
221          ]]&gt;
222        &lt;/body&gt;
223      &lt;/method&gt;
224</pre>
225    <p>
226      Second a standard function&nbsp;:
227    </p>
228    <pre>
229      function getCellChecked(tree) {
230 
231        var ret='';
232        var col = document.getAnonymousElementByAttribute(this, "
 >type", "checkbox");
233       // ordinal step is 1 - 3  - 5 - 7  ....
234        var Pos= parseInt(col.ordinal/2);
235         for (var i =0; i&lt;tree.view.rowCount;i++){
236                if (tree.view.getCellValue(i, tree.columns.getCol
 >umnAt(Pos))=='true')
237                    ret+=tree.view.getCellText(i, tree.columns.ge
 >tColumnAt(Pos))+' ';
238              }
239              return ret==''?null:ret.substring(0,ret.length-1); 
240 
241      }

Back to History