PDA

View Full Version : Problem with gridpanel select



ismail.gul
3 Sep 2013, 12:14 AM
Hey,

I'm experiencing an interesting problem with my code. I have a gridpanel that contains some data within a store.
When I press the button it binds the gridpanel's store with required data. When I doubleclick on any record in that gridpanel it activates an another operation. This operation works just fine, but when I try to select a record in that gridpanel it fires the exception below

"Uncaught TypeError: Cannot call method 'apply' of undefined"

I checked "ext-all-debug.js" file where the problem is


if (!me.suspended && count > 0) {
me.firing = true;
args = arguments.length ? arraySlice.call(arguments, 0) : []
len = args.length;
for (i = 0; i < count; i++) {
listener = listeners[i];
if (listener.o) {
args[len] = listener.o;
}
if (listener && listener.fireFn.apply(listener.scope || me.observable, args) === false) {
return (me.firing = false);
}
}
}
me.firing = false;
return true;

When I select a row in the gridpnanel and debug that this operation comes to that point. count variable is "1" and because of that it steps into if statement but after that it just passes the for loop even if the count is equal to 1. "listener.fireFn.apply" is where the exception is thrown.

It doesn't effect my operation for bindStore method of gridpanel but when I try loadRawData to load the store. It fills the store when I click the button for the first time to load store but if I select any row it doesn't fill the store after that. I think it's because of the exception I mentioned.

My gridpanel as below:

{ xtype: 'gridpanel',
x: 0,
y: 60,
height: 600,
width: 510,
itemId : 'gridService',
title: '',
viewConfig: {
itemId: 'gridServiceListView'
},
listeners: {
itemdblclick: {
fn: me.onDoubleClick,
scope: me
},
select: {
fn: me.onClick, //Just wanted to check when the exception is thrown.
scope: me
}

},
store:{
....
}
}


onClick : function()
{
alert('hey!');
}
After alert it jumps to "ext-all-debug.js" to the line where the for loop starts.

Gary Schlosberg
5 Sep 2013, 7:47 AM
My guess is that you're running into a problem trying to listen for click and doubleclick on the same element. Due to the difficulty in distinguishing the two, it can be problematic.
http://www.sencha.com/forum/showthread.php?79243

ismail.gul
5 Sep 2013, 12:38 PM
Problem solved. In one of my controllers there was a selectchange event defined in the init method. I was copied that init method from another project and didn't realize that. Even if the method that selectchange event calls isn't defined in the controller, Program can't detect that if that method is defined or not. For example:

combobox: {
selectchange: this.onClickEvent
}
If you write that in the init method of the controller even if you don't have onClickEvent event. Program just don't show you an error on the load. When you try to fire that event it just says:

"Uncaught TypeError: Cannot call method 'apply' of undefined"