Using enyo.flyweightRepeater with orient:"h"

I am trying to use enyo.flyweightRepeater with orient:"h", to create something similar to notches on a ruler. I need to get the :left positioning of every notch as they are being created. So I tried the following, but the .getBounds() properties always come up empty. Any help would be appreciated.
enyo.kind({
	name: "Tick",	
	published: {
		number : 50
	},
	components: [
		{
			kind: "FlyweightRepeater", 
			onSetupItem:"setupTick",
			//onRenderRow: "renderTick",			 
        components: [
                     { 
                    	 kind:enyo.Control,
                    	 styles: " width:3px;border-left: 1px solid grey;height: 10px;",                   	 
                     }        
		]}
	],
	numberChanged: function(){
		var f = this.$.flyweightRepeater;
		f.setCount ( 30);
		f.orient="h";
		f.render();
	},
	renderTick: function(inSender, inEvent){
		
	},
	setupTick: function(inSender, inEvent){
		console.log(inSender.getBounds().left)
		return true
	},
	create: function(){
		this.inherited( arguments );
		this.numberChanged();
	}
})

Comments

  • With the flyweight repeater, the internal components are rendered over and over to the DOM. However, after an item is rendered to the DOM, the item is detatched again before setupItem is called again. So at that time, there's nothing that we can measure the bounds of.

    In fact, the usual way of the flyweight is all the instances are actually rendered to a string, then there's just one modification of innerHtml at the end.
  • Do you have a suggestion?
  • You don't indicate what you're using getBounds for -- I assume it's not just to log to the console.
  • What lies on top of the many repeated controls is a draggable item. I want to create an event to fire whenever the draggable items left edge crosses any of the repeater items left edge. Sought of like a ruler with a slide. Does that make any sense to you?
  • edited March 2014
    Got it. Decided to do it in the rendered function. I'll just iterate the count on the repeater with:
    .fetchRowNode(x).offsetLeft
Sign In or Register to comment.