1. #1
    Sencha User steffenbrem's Avatar
    Join Date
    Mar 2012
    Posts
    36
    Vote Rating
    2
    steffenbrem is on a distinguished road

      0  

    Default HELP: Render Component into HTML element (div etc.)

    HELP: Render Component into HTML element (div etc.)


    Hello,

    How do I render an Ext Component (buttons etc.) into a normal HTML element? I've got an Ext.Container with a normal html table in it. I want to render an Ext.Button into the table. In Ext Js you can use the render() method, but I can't find any similar in Sencha Touch 2.

    Code:
    Ext.create('Ext.Container', {
        html: [
            '<table>',
                '<tr>',
                    '<td>some data...</td>',
                    '<td>' + Ext.create('Ext.Button', { text: 'Button' }) + '</td>',
                '</tr>',
            '</table>'
        ]
    });

    Thanks!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Try using the renderTo config
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User steffenbrem's Avatar
    Join Date
    Mar 2012
    Posts
    36
    Vote Rating
    2
    steffenbrem is on a distinguished road

      0  

    Default


    Can you do something like this then?

    Code:
    var div = document.createElement('div');
    
    Ext.create('Ext.Button', {
        text: 'Button',
        renderTo: div
    });

  4. #4
    Sencha Premium Member dawesi's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,083
    Vote Rating
    44
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      1  

    Default


    it would be renderTo: 'div' (with quotes) where 'div' is the id of the div

    so if you had

    Code:
    <div id="myContainer"></div>
    then you would code:

    Code:
    http://docs.sencha.com/ext-js/4-1/#!/api/Ext.AbstractComponent-cfg-renderTo
    
    
    
    var div = document.createElement('div');Ext.create('Ext.Button', {    text: 'Button',    renderTo: 'myContainer'});
    Teahouse Training Company
    Official Certified Sencha Trainer

    Australia / New Zealand / Singapore / Hong Kong & APAC



    SenchaWorld.com - Sencha webinars, videos, etc
    SenchaForge.org - (coming soon)
    TeahouseHQ.com - Sencha ecosystem training portal

    Code Validation : JSLint | JSONLint | JSONPLint

  5. #5
    Sencha User steffenbrem's Avatar
    Join Date
    Mar 2012
    Posts
    36
    Vote Rating
    2
    steffenbrem is on a distinguished road

      0  

    Default


    Thanks dawesi! Maybe it's a good thing to update those things in the docs? So I would know that I could render it to an element ID etc.

    Well, it's working now, thanks guys

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi