1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    85
    Answers
    6
    Vote Rating
    0
    toxkillfraex is on a distinguished road

      0  

    Default Answered: trying to get tpl divs

    Answered: trying to get tpl divs


    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

  2. I worked around this issue by not trying to make buttons.

  3. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    85
    Answers
    6
    Vote Rating
    0
    toxkillfraex is on a distinguished road

      0  

    Default


    also right now there's only one line of data in the store so the id should be fully unique right now

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    85
    Answers
    6
    Vote Rating
    0
    toxkillfraex is on a distinguished road

      0  

    Default


    this is driving me absolutely crazy...

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

  5. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    85
    Answers
    6
    Vote Rating
    0
    toxkillfraex is on a distinguished road

      0  

    Default


    I worked around this issue by not trying to make buttons.

Tags for this Thread