PDA

View Full Version : trying to get tpl divs



toxkillfraex
2 Mar 2012, 2:15 AM
I'm trying to get the divs made by the tpl so I can render to them, but it's unable to find them ... I think
or I'm calling it in the wrong way...

This is made in another class/element that I defined as the me variable a little while before

var someViewTest = Ext.create('Ext.view.View',
{
store: me.store,
itemSelector: 'div.'+ me.customClass,
tpl: [
'<tpl for=".">',
'<div class="'+ me.customClass+'" id="1">',
'</div>',
'</tpl>'
],
listeners:
{
afterrender:function()
{

console.log('in afterrended');
var storeLength = this.store.data.length;

this.store.each(function(r)
{
console.log(r.get('id'));
console.log(Ext.Element.get('#1'));//doesn't work rly doesn't
Ext.create('Ext.button.Button',
{
xtype:'button',
ui:'action',
renderTo: Ext.get('1')

});
});
}
}
});

I've tried with 1 and #1 and .1
I tried calling another function in the class as well with the same stuff
I also tried Ext.get but the console always gives me null I tried getting a div from the index page that's there from start and that works as expected and shows helpful stuff in the console
I know it makes the elements because I can find them in the html when i load the page
is afterrender the wrong listener thing to do it in?

I'm hoping to make buttons with icons and text based on the data in a store for now I'm working with dummy data

toxkillfraex
2 Mar 2012, 2:21 AM
also right now there's only one line of data in the store so the id should be fully unique right now

toxkillfraex
2 Mar 2012, 6:12 AM
this is driving me absolutely crazy...

I just really want to generate buttons based of data in a store....

toxkillfraex
5 Mar 2012, 1:18 AM
I worked around this issue by not trying to make buttons.