PDA

View Full Version : Put items dinamically in a list from a store



javi10823
3 May 2012, 8:31 AM
I need to add items dinamically in a list with a store.

How can i Do that?

I have this list:

{
xtype: 'list',
grouped : true,
indexBar : true,
id:'listaindex',
listeners: {
itemtap: {
fn: function (list, index, item, evt) {
//console.log('Presiona Grilla');
}
,
element: 'element'
}
}

,
hideOnMaskTap: false,
store:Ext.create('CargaHorarioApp.store.ConsultaStore'),
//itemTpl: '<div class="contact">{value} <strong>{label}</strong></div>'
itemTpl: '<div class="contact">{des} &nbsp;-&nbsp;<strong>{horas_trabajadas}&nbsp;Hs.</strong></div>'
}

With this store:

Ext.define('CargaHorarioApp.store.ConsultaStore', {
extend: 'Ext.data.Store',
id:'consultaStore',
config: {
autoload:false,
model: 'CargaHorarioApp.model.Consulta',
sorters: 'fDesde',
grouper: {
groupFn: function(record) {
return record.get('fDesde');
}
},
proxy: {
type: 'jsonp',
//url: 'http://192.168.0.103/ca/py757.data.php?db=cHkyNjI&oper=auto&what=tareas',
// url: 'file.json',
extraParams :{
// uuid: device.uuid
// uuid:'1',
// mes:'04',
// anio:'2012'

},
reader: {
type: 'json'
}
}
} ,
constructor: function() {
console.log('ingreso consulta hs store');
this.callParent();
}
});

mitchellsimoens
5 May 2012, 5:48 AM
What do you mean add items dynamically into the list? The list will show what the store has.