우리의 유효성 검사 테두리가 더 이상 작동하지 않습니다 (이전에 작동 중이었습니다). 불행히도이 버그는 바이올린에서 재생산 할 수 없지만 extJS 코드에 최대한 깊이 파 내려고 노력했습니다.Extjs 유효성 검사 테두리가 작동하지 않습니다.
구성 요소에 유효성 검사 테두리를 표시하는 방법이 있습니다. 이름과 유형이 전달되고 GUI 구성 요소가 검색됩니다. 이 부분은 항상
showValidationBorder: function (name, type) { //'myField' 'textfield'
var _this = this;
var cmp = this.queryGuiComponent(type, name); //got a cmp!!
cmp.markInvalid('My Invalid Message!!!'); //:(
},
이제 우리는 구성 요소에 markInvalid전화를 사용할 수 있습니다. markInvalid는 form.field.Base 클래스에 있습니다.
Ext.define('Ext.form.field.Base', {
markInvalid : function(errors) {
// Save the message and fire the 'invalid' event
var me = this,
oldMsg = me.getActiveError(),
active;
me.setActiveErrors(Ext.Array.from(errors)); //:(
active = me.getActiveError();
if (oldMsg !== active) {
me.setError(active);
}
},
setActiveErrors은 다음 Ext.form.Labelable에 살고있는라고합니다. getTpl는 에 Ext.AbstractComponent 인
Ext.define("Ext.form.Labelable", {
setActiveErrors: function(errors) {
errors = Ext.Array.from(errors);
this.activeError = errors[0];
this.activeErrors = errors;
this.activeError = this.getTpl('activeErrorsTpl').apply({ // :(
errors: errors,
listCls: Ext.plainListCls
});
this.renderActiveError();
},
라고합니다. 이 메소드의 getTpl는 항상 체인에서 '정의되지 않은'오류를 일으키는 null을 반환합니다.
Ext.define('Ext.AbstractComponent', {
/**
* @private
*/
getTpl: function(name) {
return Ext.XTemplate.getTpl(this, name); //:(
},
이 getTpl 방법 XTemplates 클래스이다.
Ext.define('Ext.XTemplate', {
getTpl: function (instance, name) {
var tpl = instance[name], // go for it! 99% of the time we will get it!
owner;
if (tpl && !tpl.isTemplate) { // tpl is just a configuration (not an instance)
// create the template instance from the configuration:
tpl = Ext.ClassManager.dynInstantiate('Ext.XTemplate', tpl);
// and replace the reference with the new instance:
if (instance.hasOwnProperty(name)) { // the tpl is on the instance
owner = instance;
} else { // must be somewhere in the prototype chain
for (owner = instance.self.prototype; owner && !owner.hasOwnProperty(name); owner = owner.superclass) {
}
}
owner[name] = tpl;
tpl.owner = owner;
}
// else !tpl (no such tpl) or the tpl is an instance already... either way, tpl
// is ready to return
return tpl || null;
}
getTpl 함수는 인스턴스 (텍스트 필드)에서 'activeErrorTpl'을 가져 오려고 시도합니다. 왜냐하면 '정의되지 않은'오류가 생성 될 수 없기 때문입니다. 인스턴스 객체를 보면 'acitveError', 'activeErrors'와 비슷한 객체가 있지만 'activeErrorTpl'은 없습니다. 누구든지 아이디어가 있습니까
는 무엇을 잘못 여기에 갈 수 있을까? 유효성 검증 오류에 대해 일종의 템플리트를 설정해야합니까?