0
아약스 호출이 성공하면 sencha 템플릿을 업데이트해야합니다. 샘플 코드는 내가 템플릿을 업데이트해야 success
에 Sencha에서 부모 개체에 액세스
this.getTpl is not a function
[Break On This Error]
this.setHtml(this.getTpl().apply(response.responseText));
오류 콘솔
Ext.define('casta.view.Intro', {
extend: 'Ext.tab.Panel',
tpl: '<p> {username} </p>',
initComponent: function(){
//Be sure to use the var keyword for planet earth, otherwise its declared as a global variable
//var planetEarth = { name: "Earth", mass: 1.00 };
//this.setHtml(this.getTpl().apply(planetEarth));
Ext.Ajax.request(
{
waitMsg: 'Bitte warten...',
url: 'http://localhost:8000/api/casta/user/?format=json',
success:function(response,options){
//var responseData = Ext.util.JSON.decode(response.responseText);
this.setHtml(this.getTpl().apply(response.responseText));
}
}
);
}
});
아래처럼하지만 문제는 인라인 함수
success:function
내부 정의의 해당 this.getTpl입니다.
initcomponent
후에 정의됩니다. 나는 그 안에
success
라고 부를 필요가있다. 어떤 아이디어?