Ext.Ajax.request({
url: AventoCrm.app.storeUrl+'(\'Dialogue\')/fields',
headers:{
'Accept':'application/json;odata=verbose'
},
success: function(response) {
try{
var resp = response.responseText;
if(resp) {
var data = Ext.JSON.decode(resp);
fields = [{
name: 'id'
}];
for(var i = 0, len = data.d.results.length; i < len; i++){
// AventoCrm.app.DialogueFields.push({name:data.d.results[i].InternalName});
fields[i+1] = {
name: data.d.results[i].InternalName
}
}
AventoCrm.app.x=Ext.define('AventoCrm.model.DialogueModel', {extend: 'Ext.data.Model',fields:fields});
alert(fields[1].name);
alert(AventoCrm.app.x);
}
}catch(e){
console.error(e);
}
},
failure: function(e){
console.error(e);
}
});
Ext.define('AventoCrm.store.DialogueStore',{
extend: 'Ext.data.Store',
requires: [
// 'AventoCrm.model.DialogueModel',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Xml'
],
config: {
autoLoad: true,
autoSync: true,
model: AventoCrm.app.x,
storeId: 'DialogueStore',
proxy: {
type: 'rest',
url: AventoCrm.app.storeUrl+'(\'Dialogue\')/items',
reader: {
type: 'xml',
record: 'entry'
}
}
}
});
Aucun commentaire:
Enregistrer un commentaire