0

I have a form with a textfield and it has a trigger to search on the text entered. I want to allow the user to type only numbers in it and allow the user to type the entire amount he wants to and when the user completes typing render it to number format(0.000000). Just like how we use renderers in grid columns. How can I achieve this in a form. I tried this way

{
            xtype: 'textfield',
            bind: {
                value: {
                    bindTo: '{salesPriceValue}',
                    twoWay: false

                },
                //disabled: '{!customerPartFilled}',
                //disabled: '{disableSalesPrice}',

                mode: '{currentHeader.adjustmentTypeId}',
                readOnly: '{!securityAccessDetailForm}',
                hideTrigger: '{hideSalesTrigger}'
            },
            fieldLabel: 'Sales Price',
            reference: 'salesPrice',
           // maskRe: /[0-9.-]/,
            regex: /^\-*\d+(\.\d{1,6})?$/,
            flex: 1,
           // hideTrigger: true,
            checkChangeBuffer: 550,
            checkChangeEvents: ['keyup'],
            setMode: function(mode) {
                FACTT.app.setComponentMode(this, mode);
            },
            listeners: {
                change: 'onSellingPriceChange'
            },
            triggers: {
                mytrigger: {
                    handler: 'onSellingPriceLookup',
                    cls: 'x-form-search-trigger'
                }
            }
        in view model
        salesPriceValue: {
        bind: {
            Price: '{currentDetail.salesPrice}'
        },
        get: function(data) {

            if(Ext.isEmpty(data.Price) || data.Price === 0 ){
                return Ext.util.Format.number(data.Price, "0.000000");
            }
            else{
                return data.Price;
            }
           // return Ext.util.Format.number(data.Price, "0.000000");
        }
    }

But I am unable to show it in the number format if the user enters 30.

Sweety
  • 31
  • 6

0 Answers0