Ensure the tree selection exists before trying to do things to it b=397788 r=jag

git-svn-id: svn://10.0.0.236/trunk@237400 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
neil%parkwaycc.co.uk 2007-10-08 12:10:51 +00:00
parent c5df0934dd
commit 35004d2094

View File

@ -1441,6 +1441,11 @@
null null
</field> </field>
<!-- Setting tree.view doesn't always immediately create a selection,
so we ensure the selection by asking the tree for the view. Note:
this.view.selection is quicker if we know the selection exists. -->
<property name="selection" onget="return this.tree.view.selection;"/>
<property name="pageCount" <property name="pageCount"
onget="return this.tree.treeBoxObject.getPageLength();"/> onget="return this.tree.treeBoxObject.getPageLength();"/>
@ -1481,7 +1486,7 @@
<method name="clearSelection"> <method name="clearSelection">
<body> <body>
this.view.selection.clearSelection(); this.selection.clearSelection();
</body> </body>
</method> </method>
@ -1538,7 +1543,7 @@
<property name="selectedIndex"> <property name="selectedIndex">
<getter> <getter>
if (!this.view || !this.view.selection.count) if (!this.view || !this.selection.count)
return -1; return -1;
var start = {}, end = {}; var start = {}, end = {};
this.view.selection.getRangeAt(0, start, end); this.view.selection.getRangeAt(0, start, end);
@ -1546,7 +1551,7 @@
</getter> </getter>
<setter> <setter>
if (this.view) { if (this.view) {
this.view.selection.select(val); this.selection.select(val);
if (val >= 0) { if (val >= 0) {
this.view.selection.currentIndex = -1; this.view.selection.currentIndex = -1;
this.tree.treeBoxObject.ensureRowIsVisible(val); this.tree.treeBoxObject.ensureRowIsVisible(val);