日期:2014-05-16  浏览次数:20370 次

Extjs htmleditor,Panel
大家好,小弟有两个问题解决不了,

1. 我想在页面加载完成时,给htmleditor(eMessage)设置一个焦点

2. 我有一个Panel(pMessage)在container 中,我只想显示纵向滚动条(当前横向,纵向都显示)。

哪位朋友搞过,帮帮忙!非常感谢 

1. 关键代码

{
  xtype: 'container',
  width: 530,
  height: 120,
  x: 0,
  y: 400,
  items: [
  {
  xtype: 'htmleditor',
  id: 'eMessage',
  height: 123,
  width: 530,
  listeners: {
  "keydown": function(editor, e) {
  if (e.keyCode == 13 && !e.shiftKey) {
  Send();
  }

  }
  }
  }
  ]
  }



2.关键代码 


{
  xtype: 'container',
  id:'pnl',
  x: 0,
  y: 0,
  height: 400,
  width: 530,
  autoScroll: true,  
  items: [
  {
  xtype: 'panel',
  id: 'pMessage',
  height: 400,
  width: 530,  
  html: ''  
  }
  ]
  },



------解决方案--------------------
获取焦点,给你的窗口加一个事件
yourwindow.on('show', function() {
Ext.getCmp('eMessage').focus(true, true);
})
即可在窗口显示时,设置焦点