views:

14

answers:

1

I am struggling to find any resources on firefox extensions which construct a sidebar and put elements into them. plus tyhe other functionalities within a sidebar. I have made a emptysidebar. Now i need to display a dynamic array(which is formed using a JS function). I have absolutely no idea how to go about it. Can someone please help! this is the code of the sidebar page. I need a xul element like the menuitem where i can display a list of items. How do i get that in a sidebar?

<page id="sbEmptySidebar" title="emptysidebar"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>   <vbox flex="1">
        <label id ="l1">

  </vbox> </page>
A: 

You should used a list box, it would be the best way to display an array of elements in the sidebar. You can check here for more details on the XUL element:

https://developer.mozilla.org/en/XUL_Tutorial/List_Controls

In order to add elements dynamically from JavaScript you can use the appendItem() function on the listbox object, check here for more details and examples:

https://developer.mozilla.org/en/XUL_Tutorial/Manipulating_Lists

fms