/**
* Created with IntelliJ IDEA.
* User: seeker910
* Date: 13-11-8
* Time: 上午1:36
* To change this template use File | Settings | File Templates.
*/
Rsd.define('Rsd.form.Text', {
extend: 'Rsd.form.Input',
xtype: 'text',
margin:'2 0 2 0',
// height: 25,
// width: 80,
inputType: 'text',
ctrlCls: 'x-control-text',
handler: null,
/**
* 输入框选择器按钮配置
* {
style:null,
text:'[选 择]',
handler:''
}
*/
//selector:null,
/**
*
* @param {*} config
*/
constructor: function constructor(config) {
config = config || {};
this.apply(config);
},
/**
* 初始化 仅创建对象,并未渲染dom结构
*/
initComponentEx: function initComponentEx()
{
this.callParent();
if(this.selector)
{
var me = this;
var selector = me.selector;
var btn = document.createElement('a');
selector.element = btn;
btn.id = this.id + '__selector';
btn.innerHTML = selector.text || "[选 择]";
btn.title = selector.tip||selector.title||'';
btn.style.marginRight = "5px";
btn.style.float = "right";
btn.style.position = "relative";
btn.style.zIndex = 9999;
btn.style.lineHeight = me.height + 'px';
btn.href="javascript:void(0);"
me.ctrl.element.ondblclick = btn.onclick = function (sender, event) {
if(selector.handler||selector.fn)
{
me.funApplyByIOC(selector.handler||selector.fn, [sender, event]);
}
}
me.setElStyle(btn,selector.style||{});
}
},
/**
*
*/
onAfterRender:function onAfterRender()
{
this.callParent();
if(this.selector && this.selector.element)
{
this.dom.appendChild(this.selector.element);
}
}
},function(type){
var _selectorGetter = function () {
return this.___selector;
};
var _selectorSetter = function (value) {
if(Rsd.isEmpty(value))
{
this.___selector = null;
return;
}
this.___selector = Rsd.apply({style:null, text:'[选 择]', handler:''},value);
}
this.defineProperty(type,"selector", _selectorGetter, _selectorSetter,false);
});