Hybrid View

  1. #1
    Sencha User coshmos's Avatar
    Join Date
    Apr 2012
    Posts
    18
    Answers
    2
    Vote Rating
    1
    coshmos is on a distinguished road

      0  

    Default Answered: Add event to input

    Answered: Add event to input


    Hi.

    I create number inputs by the way described below:

    Code:
    var quantityInput = this.createNumberInput('Quantity', 'QuantityLabel', 0, 0, 100);
    
    
    createNumberInput: function (name, label, defaultValue, minimumValue, maximumValue) {
        var input = {};
        input.xtype = 'numberfield';
        input.fieldLabel = label;
        input.hiddenName = name + 'ID';
        input.name = this.inputPrefix + '.' + name;
        input.id = name;
        input.value = defaultValue;
        input.minValue = minimumValue;
        input.maxValue = maximumValue;
    
    
        return input;
    }
    How I could add event 'change' to the quantityInput?

  2. If you want to do it in your createNumberInput function you can specify a listeners object so that once it gets created it uses it.
    http://docs.sencha.com/ext-js/4-1/#!...-cfg-listeners

    Or after it is created or if you used Ext.create instead of an anonymous object you could call quantityInput.on( 'change', someFunction )
    http://docs.sencha.com/ext-js/4-1/#!...able-method-on

    Or if you were to use MVC you could control all your inputs from the controller
    http://docs.sencha.com/ext-js/4-1/#!...method-control

  3. #2
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    536
    Answers
    61
    Vote Rating
    70
    Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough

      0  

    Default


    If you want to do it in your createNumberInput function you can specify a listeners object so that once it gets created it uses it.
    http://docs.sencha.com/ext-js/4-1/#!...-cfg-listeners

    Or after it is created or if you used Ext.create instead of an anonymous object you could call quantityInput.on( 'change', someFunction )
    http://docs.sencha.com/ext-js/4-1/#!...able-method-on

    Or if you were to use MVC you could control all your inputs from the controller
    http://docs.sencha.com/ext-js/4-1/#!...method-control

  4. #3
    Sencha User coshmos's Avatar
    Join Date
    Apr 2012
    Posts
    18
    Answers
    2
    Vote Rating
    1
    coshmos is on a distinguished road

      0  

    Default


    Could you provide an example of assigning listener, because I clearly don't understand what I should write, because I don't create numberInput by the standard method. So, should I write something like:
    Code:
    input.listeners = {change: {fn: function() alert('Changed');}};
    If so, so the code doesn't work. And about the second method, I tried below code:
    Code:
    quantityInput.on('change', alert('Changed'););
    But it fired everytime I opened page and JS console typed the error Object #<Object> has no method 'on'.

  5. #4
    Sencha User coshmos's Avatar
    Join Date
    Apr 2012
    Posts
    18
    Answers
    2
    Vote Rating
    1
    coshmos is on a distinguished road

      0  

    Default


    Done. By adding listener. Thanks.
    Code:
    		quantityInput.listeners = {
    			change: {
    				fn: function (x, y, z) {
    					alert('Changed');
    				}
    			}
    		};

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