-
20 Dec 2012 7:12 AM #1
MVC - Actioncolumn Event fires twice
MVC - Actioncolumn Event fires twice
Hello,
after changing to 4.2.0 beta i have the following problem.
In the grid i have configured an action column like this:
In the controller the init function looks like this:PHP Code:{
xtype : 'actioncolumn',
width : 20,
items : [
{
icon : 'system/icons/page_white_acrobat.png',
handler : function(grid, rowIndex, colIndex) {
this.fireEvent('show_pdf', this, grid, rowIndex, colIndex);
}
}
]
}
The console logs the text 'TEST' twice, when the action column is clicked - in 4.1.1 it logs 'TEST' once.PHP Code:init: function() {
this.control({
'system_info actioncolumn': {
show_pdf: this.onShowPDF
}
})
},
onShowPDF: function(view, cell, row, col, e){
console.log('TEST')
}
Any tips?
Thanks in advance.
Michi
-
20 Dec 2012 11:39 AM #2
Thanks for reporting this issue, we're looking into it.
Regards,
Alex.
-
20 Dec 2012 12:30 PM #3
Can't reproduce this problem in my setup. Can you post more code please?
Regards,
Alex.
-
20 Dec 2012 9:04 PM #4
Hello,
here is more code for this problem:
The controller code:
The view:PHP Code:Ext.define('AM.controller.system.info', {
extend: 'Ext.app.Controller',
require: 'Ext.ux.RowExpander',
views: [ 'system.info', 'nav.system_details' ],
stores: [ 'nav.system_update' ],
models: [ 'nav.system_update' ],
init: function() {
this.control({
'system_info actioncolumn': {
show_pdf: this.onShowPDF
},
'system_info': {
close: function () {
Ext.getCmp('center_id').getActiveTab().close();
}
},
'system_info grid': {
//Bei diesem Event muss das Layout des Tabs neu gerechnet werden, wegen event. Srollbar...
groupclick: function(view){
view.up('tabpanel').getActiveTab().doLayout();
}
}
});
},
onShowPDF: function(view, cell, row, col, e){ console.log('TEST')
}
});
The store:PHP Code:Ext.Loader.setPath('Ext.ux', 'system/extjs/examples/ux/');
Ext.require([ 'Ext.ux.RowExpander' ]);
Ext.define('AM.view.system.info' ,{
extend: 'Ext.tab.Panel',
alias : 'widget.system_info',
iconCls : 'settings',
height: 200,
title : 'Systeminformation',
activeTab: 0,
initComponent: function() {
this.items = [
{
xtype : 'system_details',
title : 'Allgemein',
nameColumnWidth : 170,
iconCls : ''
},
{
xtype : 'gridpanel',
title : 'Updateverlauf',
store : 'nav.system_update',
columns : [
{
text : 'Build kalkTOOL',
flex : 1,
dataIndex : 'prg_version',
summaryType : 'count',
summaryRenderer : function(value) {
return ((value === 0 || value > 1) ? '' + value + ' Patches' : '1 Patch');
}
},
{
text : 'Kategorie',
dataIndex : 'prg_kategorie'
},
{
text : 'Datum',
dataIndex : 'prg_time_real',
renderer : Ext.util.Format.dateRenderer('d.m.Y H:i')
},
{
xtype : 'actioncolumn',
width : 20,
items : [
{
icon : 'system/icons/page_white_acrobat.png',
handler : function(grid, rowIndex, colIndex) {
this.fireEvent('show_pdf', this, grid, rowIndex, colIndex);
}
}
]
}
],
viewConfig :
{
stripeRows : true,
loadingText : 'Daten werden geladen...'
},
// toFIX Dieses Plugin ist defekt in 4.2.0 beta
//
plugins : [
{
ptype : 'rowexpander',
rowBodyTpl : ['<p><b>Informationen zum Patch:<br><br></b> {prg_text}</p>'
]
}
]
}
];
this.callParent(arguments);
}
});
And the model:PHP Code:Ext.define('AM.store.nav.system_update',
{
extend : 'Ext.data.Store',
model : 'AM.model.nav.system_update',
autoLoad : true,
groupDir : 'DESC',
groupField : 'prg_time_year',
proxy :
{
type : 'ajax',
url : 'prg/system_updateverlauf/system_updateverlauf_db.php',
reader :
{
root : 'data',
totalProperty : 'count',
id : 'id'
}
}
});
The os is windows 7 and browser is chrome 23.0.1271.97 m.PHP Code:Ext.define('AM.model.nav.system_update',
{
extend : 'Ext.data.Model',
fields : [
{
name : 'id',
type : 'int'
},
{
name : 'prg_version'
},
{
name : 'prg_time_real',
type : 'date',
dateFormat : 'Y-m-d H:i:s'
},
{
name : 'prg_time_year',
convert : function(value, record) {
prg_time_year = record.data.prg_time_real.getFullYear();
return prg_time_year;
}
},
{
name : 'prg_kategorie'
},
{
name : 'prg_text'
},
{
name : 'prg_document_path'
}
],
idProperty : 'id'
});
Thanks!
Michi
-
2 Jan 2013 12:50 AM #5
Hello,
any Ideas? How can i debug where the event is fired?
Thanks!
Michi
-
8 Jan 2013 11:10 AM #6
Hi Michi,
Sorry, holidays intervened. :) Looking into it now.
Regards,
Alex.
-
8 Jan 2013 12:10 PM #7
Still can't reproduce it on the latest codebase. When I click on the icon, console logs 'TEST' once per click. Could it be that you handle this particular event somewhere else and log additional message there?
Regards,
Alex.
-
8 Jan 2013 11:12 PM #8
Hello Alex,
thanks for your reply.
I still think it is a problem with 4.2 beta, cause with 4.1.1 this behaviour is not occured!
Is there a possibility to catch from where the event is fired twice?
When will the next beta or RC1 released?
Thanks!
Michi
-
9 Jan 2013 10:22 AM #9
Michi,
This may have been a problem with 4.2 Beta 1, but since then a big chunk of MVC code has been merged, so the situation has changed. Hey, that's what betas are for! :) Beta 2 should be available Real Soon Now.
As for tracing where it comes from, I'd suggest waiting for Beta 2 and trying this code with it. If it still fires twice, place debugger statement in the event handler and go up the stack to see where the event comes from. Chances are it's a similar chunk of code somewhere else in your application; you can try to differentiate by logging something else than just "TEST".
Regards,
Alex.
-
19 Mar 2013 7:00 AM #10
Hello,
I am using ExtJS 4.2.0 and I have the similar problem. The event is fired twice.
Regards
Medley
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote