0
다음 코드가 있습니다. url.local 또는 url.remote가 선택된 경우 기반으로 프록시의 유형 및 url 속성을 동적으로 만들고 싶습니다.어떻게 변수의 값을 기반으로 ExtJS 객체를 동적으로 생성합니까?
if (url.local)
{
proxy:{
type: 'jsonp'
url: url.local,
// etc
}
}
else if (url.remote)
{
proxy:{
type: 'rest'
url: url.remote,
// etc
}
}
을 미안하지만 난 더 추가하려면 상황에 맞는 어떤 종류의 모르겠어요 즉
var url = {
local: './grid-filtering/sample.json', // static data file
remote: '/Customer/Get'
};
Ext.require('sbpm.model.Product');
Ext.define('sbpm.store.Customer', {
extend: 'Ext.data.JsonStore',
constructor: function (cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
// store configs
autoDestroy: true,
storeId: 'Customer',
model: 'sbpm.model.Product',
proxy: {
type: 'jsonp',
url: url.local,
reader: {
root: 'data',
totalProperty: 'total'
}
},
remoteSort: false,
sorters: [{
property: 'company',
direction: 'ASC'
}],
pageSize: 50
}), cfg]);
}
});
은, 내가 뭘하려는 (의사 코드)를 지정하다 그 시나리오를 설명하거나, stackoverflow가 그것을 측정하기 위해 어떤 종류의 텍스트/코드 비율을 사용한다면, 내가 이미 그 시나리오를 매우 간결하게 설명했음을 알게되고 성서를 이해하지 못한다면 더 자세한 질문을 할 수 있습니다.
완벽합니다. 고마워! 당신은 그것을 보았 니? 나는 그렇게 느낀다 n00b; 나는 그것을 알아야했다. – rivanov
예. 방금 출처를 보았습니다. ExtJs는 매우 잘 구조화되고 잘 주석 처리 된 소스 코드를 가지고 있습니다. – sha