I need to pass the value of selected item in the list to a list of detail to load data from a store.
The code view is
Ext.define('App.view.PresidentList', {
extend: 'Ext.List',
xtype: 'presidentlist',
requires: ['App.store.Presidents','Ext.dataview.NestedList','Ext.data.proxy.JsonP'],
config: {
title: 'Events',
iconCls: 'star',
//grouped: true,
itemTpl: '<b>{evento}</b><br>{nombre}',
store: 'Presidents',
onItemDisclosure: true,
}
});
The code controller is
Ext.define('App.controller.Main', {
extend: 'Ext.app.Controller',
config: {
refs: {
main: 'mainpanel'
},
control: {
'presidentlist': {
disclose: 'showDetail'
}
}
},
showDetail: function(list, record) {
var listItems = Ext.create('App.store.ListItems', {newUrl : record.getData()});
listItems.load();
this.getMain().push({
xtype: 'presidentdetail',
title: record.fullName(),
data: record.getData(),
store: listItems
});
}
});
the code view datail is
Ext.define('App.view.PresidentDetail', {
extend: 'Ext.tab.Panel',
xtype: 'presidentdetail',
config: {
title: 'Details',
scrollable: 'vertical',
items:
[
{
extend: 'Ext.List',
xtype: 'presidentlist',
requires: ['App.store.ListItems','Ext.dataview.NestedList','Ext.data.proxy.JsonP'],
config: {
title: 'Events',
iconCls: 'star',
//grouped: true,
itemTpl: '<b>{evento}</b><br>{nombre}',
store: 'ListItems',
onItemDisclosure: true,
}
},
{
xtype: 'nestedlist',
title: 'Contactos',
id: 'panel2',
useToolbar:false,
displayField: 'title',
store: {
type: 'tree',
fields: [
'title','link','author','contentSnippet','content',
{name: 'leaf', defaultValue: true}
],
root: {
leaf: false
},
proxy: {
type: 'jsonp',
url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://feeds.feedburner.com/SenchaBlog/',
reader: {
type: 'json',
rootProperty: 'responseData.feed.entries'
}
}
},
detailCard: {
xtype: 'panel',
scrollable: true,
styleHtmlContent: true
},
listeners: {
itemtap: function(nestedList, list, index, element, post) {
this.getDetailCard().setHtml(post.get('content'));
}
}
},
{
xtype: 'panel',
id: 'panel5',
title: 'Costos',
iconCls: 'home'
},
{
xtype: 'panel',
title: 'Otros',
iconCls: 'favorites',
id: 'panel5'
},
]
}
});
and the code store of ListItems is
Ext.define('App.store.ListItems',{
extend: 'Ext.data.Store',
autoLoad: true,
config: {
model: 'App.model.President',
proxy: {
//autoLoad: true,
type: 'ajax',
url:<-------->here comes the url with the variable that is passed from the list
reader: {
type: 'json',
rootProperty: "test"
}
}
}
});
Please collaboration with this issue not to do this. thank you very much.