javascript - ExtJs Access to a controller by a view -
i have extjs app mvc model, in view have panel , pager, in controller of view, have events of view, don't know why deselect event doesn't active, other events activated (select event works ok), why problem event?
i have code:
the view:
ext.define('app.view.viewresultados', { extend: 'ext.window.window', alias: 'widget.viewresultados', id: 'viewventanaresultado', height: 295, width: 690, layout: 'fit', collapsible: true, constrain: true, resizable: true, closeaction: 'hide', initcomponent: function() { var paginador = ext.create('ext.pagingtoolbar', { // store: datastore, id:this.id+'_paginador', displayinfo: true, displaymsg: 'mostrando resultados {0} - {1} de {2}', emptymsg: "no hay resultados para mostrar", items:['-',], pagesize: 10, action: 'paginador', resizable: false, height: 50, }); var grid = ext.create('ext.grid.panel', { id: this.id+"_tabla", alternateclassname: 'ext.grid.column', sortable: true, selmodel: ext.create('ext.selection.checkboxmodel'), action: 'tabla', bbar: paginador }); ext.apply(this, { items: [grid], buttons: [ { text:'borrar selección', action: 'borrar' }] }); this.callparent(arguments); } }); the controller:
ext.define('app.controller.controlresultados', { extend: 'ext.app.controller', views : ['viewresultados'], init: function() { this.control({ 'viewresultados button[action=borrar]': { click: this.borrar }, 'viewresultados button[action=exportar_xls]': { click: this.exportar_xls }, 'viewresultados button[action=reporte]': { click: this.reporte }, 'viewresultados grid[action=tabla]': { select: this.seleccionregistros, }, 'viewresultados':{ close: this.cerrar }, '#resultados_tabla':{ deselect: this.test } }); }, borrar: function (b, e, eopts){ }, exportar_xls: function (b, e, eopts){ }, reporte: function (b, e, eopts){ }, seleccionregistros: function(grilla, record, index, eopts){ console.log("access select event"); }, eliminarseleccion :function(grilla, record, index, eopts){ }, adicionarfeatureseleccionado : function(registro){ var ventana = ext.getcmp('resultados_tabla'); console.log(ventana); }, removerfeatureseleccionado: function(registro){ console.log(registro.data["id_interno"]); }, acercamientoseleccion: function() { }, abrirventana: function(titulo, resultados){ }, cargarcapaconsulta: function(listadodatos){ }, construirtablaresultado: function(listadodatos, geom,idconsulta, idelemento, tipo){ }, construircolumnas_datastore: function(objeto,geom, tipo,idelemento ){ }, acercamientoseleccion: function() { }, acercamientoseleccioncompleta: function() { }, contiene: function(a, obj) { }, buscarcapa: function(id){ }, cerrar: function(){ }, test: function(){ console.log("funcion!"); } });
i solved mi problem this:
ext.define('ext.overrides.selection.checkboxmodel', { override: 'ext.selection.checkboxmodel', compatibility: '5.1.0', privates: { selectwitheventmulti: function(record, e, isselected) { var me = this; if (!e.shiftkey && !e.ctrlkey && e.gettarget(me.checkselector)) { if (isselected) { me.dodeselect(record); // second param here suppress event, not "keep selection" } else { me.doselect(record, true); } } else { me.callparent([record, e, isselected]); } } } });
Comments
Post a Comment