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

      0  

    Default [CLOSED] Proplem creating Ext.form.Text using markup

    [CLOSED] Proplem creating Ext.form.Text using markup


    I try to create a TextBox using markup. But not successful.
    I have a very simple mytest.html
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Test</title>
        <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" />
        <script type="text/javascript" src="ext-core-debug.js"></script>
        <script type="text/javascript" src="ext-all-debug.js"></script>
        <script type="text/javascript" src="test.js"></script>
    </head>
    <body>
        <input type='text' id='myText'/>
    </body>
    </html>
    And test.js is
    Code:
    Ext.require([
        'Ext.form.*'
    ]);
    
    Ext.onReady(function() {
        var myText = new Ext.form.Text({width:100, value: 'Hello world'});
        myText.applyToMarkup('myText');
    });
    Please help.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,541
    Vote Rating
    872
    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


    Looks like it's a bug with Ext.Component.

    This worked for this simple test, not sure if it will still work in all cases:

    Code:
    Ext.override(Ext.Component, {
    	applyToMarkup: function(el) {
    		el = Ext.get(el);
    		el.addCls("x-hidden");
    		this.allowDomMove = false;
    		this.render(el.dom.parentNode, null, true);
        }
    });
    Ext.require([
    	'Ext.form.*'
    ]);
    Ext.onReady(function() {
    	var myText = new Ext.form.Text({hideLabel: true, width: 100, value: 'Hello world'});
    	myText.applyToMarkup('myText');
    });
    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
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Ext 4 is not going to support applyTo functionality for components. This was done in order to facilitate new theming capabilities such as border radius on all components on all browsers. The existing code was slated for deprecation and won't be part of the next release.

Similar Threads

  1. creating from markup
    By shay in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 26 Jan 2009, 5:16 PM
  2. Need help creating a grid from markup with pagination
    By svaddey in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 11 Mar 2008, 9:11 AM
  3. creating forms from markup
    By jdfergason in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 21 Jan 2008, 12:58 PM
  4. form submitting combobox proplem
    By hermeslm in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 14 Nov 2007, 8:51 AM
  5. [Ext 2.0] [Solved] Creating panel from existing markup
    By sfwalter in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 6 Sep 2007, 6:27 PM

Thread Participants: 2