1. #1
    Ext User ives's Avatar
    Join Date
    Sep 2008
    Posts
    13
    Vote Rating
    0
    ives is on a distinguished road

      0  

    Question renderTo and applyTo

    renderTo and applyTo


    dear
    I am new to ext, I don't understand the difference between "renderTo", "applyTo" and "contentEl", the three config value, can use the node of dom, how situation for me to use it?

    best regards
    ives

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,503
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    • renderTo renders the Component into the specified existing element.
    • applyTo uses the specified alement as the main elementof the Component. A Component created using applyTo does not need rendering - its main element already exists.
    • contentEl is only for Panels. It simply moves the specified element into the body of the Panel when the Panel is rendered to use... as the content!

  3. #3
    Ext User
    Join Date
    Sep 2010
    Posts
    3
    Vote Rating
    0
    excel_worker is on a distinguished road

      0  

    Default


    i added the config "renderTo: Ext.get('tree-div')" and it just does not work. tree-div is the id of a div in a form in body of the page.
    I am mixed up!
    help me please.

  4. #4
    Sencha User
    Join Date
    Dec 2010
    Posts
    126
    Vote Rating
    0
    varunach is on a distinguished road

      0  

    Default


    use Ext.Element.get('tree-div')

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    91
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Is this the body of a FormPanel? In that case you shouldn't be using renderTo at all!!!

    Instead, you should be specifying the component as one of the items of the formpanel.

  6. #6
    Sencha User
    Join Date
    Jun 2012
    Posts
    4
    Vote Rating
    0
    mjrobin is on a distinguished road

      0  

    Default how do we render an image displayed in a panel to a printer?

    how do we render an image displayed in a panel to a printer?


    partial code below

    var ImagePanel = new Ext.Panel({
    id: 'images-view',
    frame: true,
    width: 500,
    height: 1000,

    autoHeight: false,
    layout: 'auto',
    align: 'middle',
    title: 'View image',
    bodyStyle:'overflow:visible',
    bodyCfg:
    {
    tag: 'div',
    cls: 'x-print-body' // Default class not applied if Custom element specified
    },
    bwrapCfg:
    {
    tag: 'div',
    cls: 'x-print-bwrap' // Default class not applied if Custom element specified
    },
    items: [tbUsers,pagingbar,datav]

    })

    // create window
    var win = new Ext.Window({
    id:'imginform-win'
    ,width: 640
    , cls: 'printer'
    ,height: 600
    ,modal: true
    ,layout:'fit'
    ,border:false
    ,closable:true
    ,renderTo:imagepop
    ,frame:true
    ,items:ImagePanel
    });


    //ImagePanel.render('imagepop');


    win.show();