Closed Bug 33781 Opened 24 years ago Closed 24 years ago

cannot put <template> in a <treeitem>

Categories

(Core :: XUL, defect, P1)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: alecf, Assigned: hyatt)

References

Details

Attachments

(2 files)

I need this in order to merge the account manager into prefs, which is a HUGE
usability win.

from mail sent to waterson/hyatt
 I talked to Chris about this a few weeks ago, and I just talked to Dave
yesterday. I'm basically trying to do the following, in the pref window tree. 

I'm trying to create a hierarchy like this: 
Appearance 
  Fonts 
Navigator 
  Smart Browsing 
  Internet Search 
Mail & Newsgroups 
  Mail Accounts 
    Account 1 
      somePage 
      anotherPage 
    Account 2 
      somePage 
      anotherPage 
  Addressing 
  Messages 
etc 

etc 
Basically I'm trying to create a dynamic branch of the pref window tree... which
is generated by a datasource. 

Here's the XUL I'm using (simplified slightly) 

<tree> 
  <treeitem> 
      <treechildren> 

        <treeitem id="accounttree" rdf:datasources="rdf:msgaccountmanager" 
                  rdf:containment="http://home.netscape.com/NC-rdf#Settings" 
                  ref="msgaccounts:/" open="true" container="true" 
                  > 
           <treerow> 
             <treecell indent="true"
url="chrome://messenger/content/pref-mailnews.xul" value="Mail
Accounts"/> 
           </treerow> 
           <template> 
             <rule> 
               <treechildren> 
                 <treeitem uri="..." open="true" 
                     PageTag="rdf:http://home.netscape.com/NC-rdf#PageTag"> 
                 <treerow > 
         <treecell indent="true" 
                        value="rdf:http://home.netscape.com/NC-rdf#Name"/> 
                  </treerow> 
                 </treeitem> 
               </treechildren> 
             </rule> 
          </template> 
        </treeitem> 

----- 
here's what happens when I actually do this: 
- the content model is generated completely correctly. I get something like 
<treeitem> 
  <treerow>... 
  <template>... 
  <treechildren>...(with contents generated correctly) 
</treeitem> 

- the "Mail Accounts" branch of this tree does not have any visible children.
Even without the
open="true" container="true" (that was just me trying to make it work) nothing
appears under this
hierarchy 

- If I make the window small enough such that I can scroll this off the top of
the tree (i.e. scrolling down, so content disappears off the top) and then try
scrolling back up, I get the "missing" rows..but for every generated row, it's
one less row that I can scroll up. 

For example, in the above example I have two accounts, which generate 4 extra
rows. This means I cannot scroll back to see see Appearance through Smart
Browsing. 

Chris said (granted, it was weeks ago) "that should Just Work, talk to hyatt" :) 
Dave said "talk to waterson, sounds like the tree isn't getting all the
notifications it should 

so I looked into the generic builder a bit, and even tried commenting out the
"if" part of OpenContainer which does a conditional notification based on if the
container is a <tree> or <treeitem> - I made the notification happen every time.
And still I get the same result.
Status: NEW → ASSIGNED
Target Milestone: --- → M15
Priority: P3 → P1
Depends on: 34546
Attached file test cast
hyatt: this is a tree bug. I've verified that RDF is pushing out valid 
notifications to the tree control, and am getting lost down in the bowels of 
OnContentAppended(). I'm reassigning to you, but will be glad to tag-team the 
bug with you tomorrow or whenever.
Assignee: waterson → hyatt
Status: ASSIGNED → NEW
Mass-moving most M15 bugs to M16
Target Milestone: M15 → M16
All tree bugs go to m18.
Status: NEW → ASSIGNED
Target Milestone: M16 → M18
hyatt: I debugged this a bit further. The tree control code is getting royally 
confused because of the <template> tag beneath the <treeitem>. The tree control 
has a lot of hard-coded assumptions about where content is located in the 
content model; for example, if the <treerow> isn't the first child of the 
<treeitem>, it doesn't draw the <treerow> at all! Try this, for example:

<tree>
  <treechildren>
    <treeitem>
      <template />
      <treerow><treecell value="foo" /></treerow>
    </treeitem>
  </treechildren>
</tree>

The <treerow> doesn't ever show up! Ooops!

I may be able to give alecf a work-around by letting you do an out-of-line 
reference to a template; e.g.,

  <tree>
    <treechildren>
      <treeitem datasources="blah" ref="bip" template="mytemplate" />
    </treechildren>
  </tree>

  <template id="mytemplate">
    ...
  </template>

I'll give that a whirl.
alecf: attached a sample workaround that uses an "out-of-line template". There 
seems to be a bug or two with *that* feature ;-), but it should get you 
started.
thanks for the workaround, chris.
mass-moving all bugs to m21 that are not dofood+, or nsbeta2+
Target Milestone: M18 → M21
fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: