1. #1
    Ext JS Premium Member n3rd's Avatar
    Join Date
    Nov 2007
    Location
    Munich
    Posts
    72
    Vote Rating
    0
    n3rd is on a distinguished road

      0  

    Question Create an Ext.Component on an existing DOM element

    Create an Ext.Component on an existing DOM element


    I'm trying to migrate a set of components I wrote for Ext 3.3 to 4.0 and I'm having some issues.

    I implemented a drag-n-drop interface based on a (pre-existing) table. The table was a component and so were its tds. This was implemented by creating the td-components via the applyTo-property and it worked very nicely. Basically what I did was hard-code the table markup in HTML, create a table-component using applyTo: 'mytable' and then iterate over all its tds and create td-components using applyTo: td[i].

    In Ext 4.0, however, there's no applyTo any more. When I instantiate a td-component it always creates another DOM element (usually a div) within that td, which is not the worst thing in the world, but it generates quite a bit of (unnecessary) HTML.

    Is there a way to avoid that additional markup?

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,337
    Vote Rating
    75
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Try renderTo. applyTo was removed from Component. It should be able to use a td as a container element for the widget.

    Now that I'm rereading your issue, I understand what you are looking for. I reread AbstractComponent and would like to ask you to try to use the el configuration property.

  3. #3
    Ext JS Premium Member n3rd's Avatar
    Join Date
    Nov 2007
    Location
    Munich
    Posts
    72
    Vote Rating
    0
    n3rd is on a distinguished road

      0  

    Default


    That appears to be what I was looking for, thank you! If only it was mentioned in the docs...

  4. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,337
    Vote Rating
    75
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    That's what i do . I'm hoping to become a regular contributor again soon.

  5. #5
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    Also, if you were using "transform" for a ComboBox to transform an existing select list, that's no longer there - so renderTo is definitely the way to go!

    stevil

  6. #6
    Sencha User
    Join Date
    Sep 2008
    Posts
    107
    Vote Rating
    0
    foxmarco is on a distinguished road

      0  

    Default


    ok for the combo... but how convert an input type="text" o "textarea" to extjs?? renderTo doesn't work!!!!

  7. #7
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    Try using a <div> instead of an input?

    stevil

  8. #8
    Sencha User
    Join Date
    Sep 2008
    Posts
    107
    Vote Rating
    0
    foxmarco is on a distinguished road

      0  

    Default


    it's impossible!!! if you usa a server side like spirng or struts you have to use input tag (auto binding of all values) , so when you load a jsp with input tag al values are binded (via server). If you use div and renderTo option as you suggest you never load the original values of all input tags.

    I can't uderstand why ext4 dev. didnt think about this problem when they've leaved the applyTo function!!!

  9. #9
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    Quote Originally Posted by foxmarco View Post
    it's impossible!!! if you usa a server side like spirng or struts you have to use input tag (auto binding of all values) , so when you load a jsp with input tag al values are binded (via server). If you use div and renderTo option as you suggest you never load the original values of all input tags.

    I can't uderstand why ext4 dev. didnt think about this problem when they've leaved the applyTo function!!!
    Unfortunately, what I *think* you need to do (server-side) is 1) emit the div, and 2) emit the JS to to set up the control with renderTo the div, but ALSO setting the value to get the original values in there.

    Now, I get that you're using another framework that wants to auto-bind, so my question is basically, "If spring/struts auto-binds, something is creating the <input> - can it be "hooked" to allow something else to be rendered and bound?" I don't know the answer to that.

    I'm using ASP.NET, and my approach has been to emit a div and JS to create AND set the value in one shot, and that works for me. Of course, I'm not using their page framework - I took over and am emitting ALL of the HTML, so I have possibly more complete control over rendering than you may have.

    stevil

    P.S. Funny thing is, they brought back "transform" for ComboBoxes... why no applyTo? Have you checked the code to see if they resurrected it but didn't document it?

  10. #10
    Sencha User
    Join Date
    Sep 2008
    Posts
    107
    Vote Rating
    0
    foxmarco is on a distinguished road

      0  

    Default


    in ext 4.02 no... i dont konw if exsist 4.03 or later! And about your question to "hook" the answer is: not possible. Spring and Struts work only via html tag standard, so in the past via extjs3 i transfom them with look and feel better.

Similar Threads

  1. create menu with existing ul li tag
    By mortezakhadem in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 13 Feb 2011, 2:03 AM
  2. Create a column layout from existing markup
    By valc in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 19 Feb 2008, 3:25 AM
  3. How do I create Accordians from existing markup?
    By redrik in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 11 Feb 2008, 11:45 AM
  4. Create a FormPanel from a existing Markup
    By galdaka in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 16 Oct 2007, 1:12 PM
  5. Switch existing html component to ext component
    By harishns in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 3 Sep 2007, 12:58 AM

Thread Participants: 4

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar