1. #1
    Sencha User
    Join Date
    May 2009
    Posts
    6
    Vote Rating
    0
    sorrro is on a distinguished road

      0  

    Question Best practice for constructing new element from html snippet and Ext elements

    Best practice for constructing new element from html snippet and Ext elements


    My question is:
    What is the best practice for constructing new element from html snippet and Ext elements?

    Lets say I have html snippet in string variable, like this:
    HTML Code:
    <div class="root">
        <div class="item"/>
        <div class="form"/>
    </div>
    And in javascript I want to create two elements:
    Code:
    var extItem = new Ext.Panel(...)
    var extForm = new Ext.FormPanel(...)
    Then combine with html - put each element into appropriate div.
    Code:
    var root = DomHelper.createDom({tag : 'div'});
    DomHelper.insertHtml('beforeEnd', root, htmlSnippet);
    DomHelper.append(DomQuery.selectNode(".item", root), extItem);
    DomHelper.append(DomQuery.selectNode(".form", root), extForm);
    And then put the created html fragment to Document:
    Code:
    DomHelper.append(DomQuery.selectNode("#inRealDocument"), root);
    Last command throws this exception (ExtJS version is 3.3.1):
    uncaught exception: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOM3Document.domConfig]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: http://localhost:8080/ext-3.3.1/ext-all-debug.js :: createHtml :: line 373" data: no]

    What am I doing wrong?

    Or, if you think this approach is not good, then - what would you suggest?
    Last edited by sorrro; 19 Apr 2011 at 5:26 AM. Reason: Added note

  2. #2
    Sencha User
    Join Date
    May 2009
    Posts
    6
    Vote Rating
    0
    sorrro is on a distinguished road

      0  

    Default


    I would appreciate any ideas or suggestions on this.
    I'm new to javascript, and I'm not sure whether this situation is usual or not.

    Is it a correct way to build UI by combining html snippet and Ext widgets this way?

  3. #3
    Sencha User Screamy's Avatar
    Join Date
    Jun 2008
    Posts
    244
    Vote Rating
    0
    Screamy is an unknown quantity at this point

      0  

    Default


    This is strictly a personal opinion, but if you're new to Javascript and ExtJs, I strongly recommend that you do everything using ExtJs objects.

Similar Threads

  1. Issue adding buttons to HTML snippet
    By Jangla in forum Ext 3.x: Help & Discussion
    Replies: 10
    Last Post: 17 Mar 2010, 4:44 AM
  2. (newbiew) [TabPanel] How to add a new tab containing an HTML snippet
    By ittayd in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 2 Jul 2009, 2:39 AM
  3. converting html snippet to ExtJS styled combobox
    By Mango_lier in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 18 Feb 2009, 7:24 AM
  4. Put HTML snippet in Ext.form.FormPanel?
    By Westside in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 24 Sep 2008, 11:10 PM
  5. Constructing Elements in HTTP vs new DOM nodes vs PHP??
    By snoodle in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 10 Apr 2008, 8:53 AM

Thread Participants: 1

Tags for this Thread

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