user3886408
user3886408

Reputation: 1

Extjs Datefield without a datepicker on a side

I have a Datefield in extjs and has following configuration:

xtype: 'datefield',
            emptyText: 'mm/dd/yyyy',
            validateOnBlur: false,
            validateOnChange: false,
            width: ifNull(uiConfig.inputWidth, 120),
            hideTrigger: this.question.unknownField,
            maxValue: new Date(),
            listeners:{
                blur:{fn:this.onBlur, scope: this},
                focus: function() {
                    if(me.controls.dateUnknown)
                        me.controls.dateUnknown.setValue(false);

I wanted to have this dateField but without the DatePicker in the side.

Upvotes: 0

Views: 2936

Answers (3)

user2380894
user2380894

Reputation: 1

in Ext JS 7.0.0

{
 xtype: 'datefield',
 format: 'd-M-Y',

 readOnly: true
}

https://docs.sencha.com/extjs/7.0.0/classic/Ext.form.field.Date.html

readOnly : Boolean BINDABLE true to prevent the user from changing the field, and hide all triggers.

Upvotes: 0

Milestonebass
Milestonebass

Reputation: 21

I found the following much simpler than the textfield customisation route:

{
 xtype: 'datefield',
 format: 'd-M-Y',
 hideTrigger: true,
 onDownArrow: Ext.emptyFn
}

(The "onDownArrow" override is to stop the picker from appearing when down arrow is pressed in the field)

Upvotes: 2

user2316489
user2316489

Reputation: 159

hideTrigger:true works to hide the picker and display only the underlying textfield

http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.form.field.Date-cfg-hideTrigger

Upvotes: 0

Related Questions