PDA

View Full Version : Is there a way to see what events are firing?



jwc
22 May 2011, 10:50 PM
I have a roweditor that after I resize or move columns, then open roweditor, the roweditor does not match the new configuration. If I reload the page then it is correct.

I looked at the source (roweditor)and see there are what appears to be functions to handle this, but I am guessing for some reason that code is not executing.

Is there a way to see if that code is running?

kembuco
23 May 2011, 8:05 PM
You could always put a breakpoint in the code if you're using Chrome or Firefox with FireBug. However, this is a bug with the RowEditor. The fix we used is something like this:


Ext.override(Ext.ux.grid.RowEditor, {
initFields: function(){
var cm = this.grid.getColumnModel(), pm = Ext.layout.ContainerLayout.prototype.parseMargins;
this.removeAll(false);
for(var i = 0, len = cm.getColumnCount(); i < len; i++){
var c = cm.getColumnAt(i),
ed = c.getEditor();
if(!ed){
ed = c.displayEditor || new Ext.form.DisplayField();
} else if(ed.rendered){
this.getLayout().configureItem(ed);
}
if(i == 0){
ed.margins = pm('0 1 2 1');
} else if(i == len - 1){
ed.margins = pm('0 0 2 1');
} else{
if (Ext.isIE) {
ed.margins = pm('0 0 2 0');
}
else {
ed.margins = pm('0 1 2 0');
}
}
ed.setWidth(cm.getColumnWidth(i));
ed.column = c;
if(ed.ownerCt !== this){
ed.on('focus', this.ensureVisible, this);
ed.on('specialkey', this.onKey, this);
}
this.insert(i, ed);
}
this.initialized = true;
},
verifyLayout: function(force){
if(this.el && (this.isVisible() || force === true)){
var row = this.grid.getView().getRow(this.rowIndex);
this.setSize(Ext.fly(row).getWidth(), Ext.isIE ? Ext.fly(row).getHeight() + 9 : undefined);
var cm = this.grid.colModel, fields = this.items.items;
for(var i = 0, len = cm.getColumnCount(); i < len; i++){
if(!cm.isHidden(i)){
var adjust = 0;
if(i === (len - 1)){
adjust += 3; // outer padding
} else{
adjust += 1;
}
fields[i].show();
var w = cm.getColumnWidth(i) - adjust;
fields[i].setWidth(w);
fields[i].width = w;
} else{
fields[i].hide();
}
}
this.doLayout();
this.positionButtons();
}
}
});

It's kinda brittle, but it's been working for us so far.

jwc
23 May 2011, 9:07 PM
Hi Kembuco,

THANK YOU, your code works beautifully!

I didn't know that I could set breakpoints with firebug...thats really cool! I'm real new to Ext and feel like my head is juustt below water level, but I'm having lots of fun learning it and going through your code to see what it is doing is already increasing my understanding.

Thanks again!

jwc

kembuco
24 May 2011, 11:58 AM
You're welcome. Good luck with the learning process and have fun.