applyTo Explanation

Filed Under mercialleasing.com |

  • Hi. We are working in my organization on making a library that converts existing HTML to various Ext Js components. I am looking at the applyTo config as an option in some cases, but I am afraid I can't make much sense of the API docs on this option.

    My understanding from digging around is that you can mimic the HTML that the component would generate as static HTML and Ext Js would use that markup to draw the component. Is this correct?


  • Its really up to you. It allows the flexibility to adapt Ext JS to an existing site using the applyTo or if you are building from the ground up and want Ext to manage the creation of the dom nodes then use the renderTo.

    I am sure you could also use the applyTo to give more style customization without having to override the Ext styles.


  • Exactly. You don't really want to make your markup so specific to the library. It's one thing to put some classes or ids in (or even custom HTML attributes) as hooks to JavaScript, it's another thing to start adding extra (nonsemantic) elements.


  • I would advocate against applyTo as it can be eventually more time consuming than let Ext render things. You would need to modify your markup for applyTo to understand it and it is not a good habit in a long run anyway.


  • I would def. have to agree with that as I had some sections where I had to manage the js code and the html markup and it was double the work when I could just let Ext manage it from the beginning.

    If you don't realllly need to use the applyTo then just stick with the renderTo.


  • You got it.

    So Ext would generate...

    header
    header-text
    bwrap
    tbar
    body
    bbar
    footer'...so if you already have those in your html structure you can just apply your component to that structure. If you do not already have the markup in your html use the renderTo config.


  • What's the advantage to already having that in your markup? My impression is that it is a shortcut to truly unobtrusive components for people that don't care about, or don't have the time, to hook Ext Js components into existing semantic markup.







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about applyTo Explanation , Please add it free.

    Comments