1. #1
    Ext User
    Join Date
    May 2009
    Posts
    41
    Vote Rating
    0
    JSCoder is on a distinguished road

      0  

    Post [EXTJS 3.0.0] Currency Field Component : Setting value via Javascript

    [EXTJS 3.0.0] Currency Field Component : Setting value via Javascript


    I'm using this currency component.
    http://www.extjs.com/forum/showthread.php?t=35741

    I process specific inputs like this
    Code:
    Ext.each(Ext.DomQuery.select("input.money"), function(item){
            new Ext.ux.dollarField({
                applyTo: item,
                allowDecimals: true,
                allowNegative: false,
                decimalPrecision: 2,
                maxValue: 1000000000,
                minValue: 0,
                selectOnFocus: true
            });
    });
    All fields which I process have unique ids.


    Problem description:

    1. Let's say I enter (manually key in) 20.00 into the field, the value sets into the field just fine.

    2. And when I do the same via javascript:
    Code:
    document.getElementById('money1').value = 40.00;
    the currency field updates fine as well.

    2. But as soon as I click on the currency field (thereby triggering its focus() event), the old value ($20.00) is restored. And this old value is set into the field on blur(). My new value 40.00 is lost.

    What am I doing wrong? Is there a specific way to set the value of a rendered currency field via Javascript?

  2. #2
    Sencha Premium Member seek's Avatar
    Join Date
    Sep 2008
    Location
    Italy
    Posts
    112
    Vote Rating
    1
    seek is on a distinguished road

      0  

    Default


    Hi JSCoder,
    try with to create your component adding:

    Code:
    Ext.each(Ext.DomQuery.select("input.money"), function(item){
            new Ext.ux.dollarField({
                applyTo: item.dom.id,
                allowDecimals: true,
                allowNegative: false,
                decimalPrecision: 2,
                maxValue: 1000000000,
                minValue: 0,
                selectOnFocus: true,
                id: item.dom.id
            });
    });
    and set value with
    Code:
    Ext.get('money1').value = 40;
    I have not tested it
    HTH
    Seek

Thread Participants: 1

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