开发者

EXTJS CustomDateField disable manual text entering

I have ExtJS grid (editorGridPanel), where one of cells is CustomDateField. How can i disable manual entering the date inside this field?

I try add listeners to editor, but there is no keypress event (!) to disable entering. Also - i try an adding of listener to whole grid, = but when editor is active, it is not fired grid keypress event.

Pls help me. Here is fiel开发者_JAVA百科d definition:

{                         
  header : "Release Date",
  dataIndex : 'releasedate',
  sortable : true,
  width: 90,

  locked: true,

  renderer: function(value, metaData, r) { 
      metaData.attr = rowcolor(r.data.status);
      return value;
  },

  editor : new Ext.ux.form.CustomDateField({
      allowBlank: true,
      format: 'm/d/Y',
      width : 120

  /* this not works VVVV */
      ,listeners: {
              'keypress' : function (field_, new_, old_  )  {
                $.log( "Field", field_ );
                $.log( "New", new_ );
                $.log( "Old", old_ );
          }
      }


  })
 },

Thanks!


This is answer:

  editor : new Ext.form.DateField({ /*Ext.ux.form.Custom*/
      allowBlank: true,
      format: 'm/d/Y',
      width : 120,
      enableKeyEvents: true,


      listeners: {
              'keydown' : function (field_, e_  )  {
//                    $.log( "keydown", field_, e_ );
                e_.stopEvent();
                return false;
          }
      }


  })


To prevent the manual input, just set the 'editable' property of the editor to false. It is true by default.

Your grid column would be like:

header: 'Test',
dataIndex: 'xyz',
editor: {
    xtype: 'datefield',
    editable: false,
}

That is a better solution provided by framework itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜