VirtualList with a popup menu for each item..

edited February 2012 in Enyo 1.0
I am trying to implement a virtualList and add a popup for each item in the list, this is how I am attempting to do it:
{flex: 1, kind: "VirtualList", name: "fileslist", onSetupRow: "setupRow", components: [
 {kind: "Item", name:"listitem"},
{caption: "aa", onclick:"aaa"},
{caption: "bb" , onclick:"bbb"},
{caption: "cc" , onclick:"ccc"}
					]}

setupRow: function (){this.$.listitem.setContent(someContent)}
The list renders, someContent shows, but the popup menu doesn't work. What am I doing wrong?
Any help would be appreciated.

Patrick

Comments

  • i don't see any popup code here?
  • Ooops! copy and pasted the wrong code I am using, here it is:
    {flex: 1, kind: "VirtualList", name: "fileslist", onSetupRow: "setupRow", components: [
    {kind: "Item", name:"listitem", components:[
    {kind: "Popup",  components: [
    			{caption: "aa", onclick:"aaa"},
    			{caption: "bb" , onclick:"bbb"},
    			{caption: "cc" , onclick:"ccc"}
    		]} ]} ]}
    setupRow: function (){this.$.listitem.setContent(someContent)}
    Also, instead of popup, I tried menu:
    {kind: "Menu", components: [{caption:"Foo"}, {caption:"Bar"}, {caption:"Bot"}]}
    
    But neither seem to work.
    Thanks.
  • I don't think its a good idea to put the popup within the item component. Try to put it at the same level as the VirtualList component. Also, ich hope you realize that you will need something like a click handler that opens that popup.
  • edited February 2012
    I think you need to open each popup individually. Maybe add an onclick to the listitem and in the click callback do:
    onclick: function(inSender, inEvent) {
        this.$.popup.openAtEvent(inEvent);
    }
  • Maybe a ListSelector would be better?
  • onclick: function(inSender, inEvent){this.$.popup.openAtEvent(inEvent);
    Yes, this is what I missed, Thank you.

    I don't think its a good idea to put the popup within the item component. Try to put it at the same level as the VirtualList component. Also, ich hope you realize that you will need something like a click handler that opens that popup.
    Right, why would I need it to create a popup for each item, makes sense. Thanks!


Sign In or Register to comment.