javascript - EXTJS 3.4 HOW TO GET RECORD DATAVIEW ON selectionchange -
how record on selection change when using ext.dataview ?
i value 'idprd' in selectionchange event function.
var tpl_ram = new ext.xtemplate( '<ul>', '<tpl for=".">', '<li class="phone">', '<img width="64" height="64" src="data/catalogo/ramos/imagenes/{idrm}/{idrm}.jpg" />', '<strong>{nomrm}</strong>', '<span>{descrm}</span>', '</li>', '</tpl>', '</ul>'); var ramos_dw = new ext.dataview({ tpl: tpl_ram, store: ramos_productos, id: 'ramos_dw', itemselector: 'li.phone', overclass: 'phone-hover', singleselect: true, autoscroll: true, autoheight: true, emptytext: 'sin resultados que mostrar', listeners: { 'click': function() {}, selectionchange: { fn: function(dv, nodes) { //i want on selection value 'idprd' var record = nodes[0]; console.log("advert id - " + record.get('idprd')) } } } });
it's not clear how model store looks like. solution data object first.
so code be:
var recorddata = nodes[0].getdata(); // keep in mind user can select more 1 node --> nodes[0] console.log("advert id - " + recorddata['idprd'])
you can put debugger;
selectionchange function listener , explore how nodes object in specific example looks like.
Comments
Post a Comment