PDA

View Full Version : Uncaught TypeError: Cannot read property 'selModel' of undefined



nimaous
20 Jun 2012, 5:00 AM
Hi
I want to know .what actually cause this error :

Uncaught TypeError: Cannot read property 'selModel' of undefined

sdt6585
20 Jun 2012, 5:28 AM
On the basic level, it just means that something tried to reference the selection model of some object that didn't have one. To be able to alleviate that problem, you would need to post the code that was the starting point for that error so there is some context to it. If you go into firebug or chrome dev tools during the error and look through the call stack on the scripts tab, you can go back to the last function of your code that executed, and that's usually where the problem is.

nimaous
20 Jun 2012, 6:11 AM
there is no any pause on stack
but I got this error because of my controller
here is my button handler in my controller :

nimaous
20 Jun 2012, 6:13 AM
onButtonClick: function(button, e, options) {

var store = this.getWaitersListStoreStore();
var grid=Ext.ComponentQuery.query('#WaitersDataGrid');
var rowEditing = grid.rowEditing;

console.log(button.id);
if (button.id == 'btt-add')
{
rowEditing.cancelEdit();
//var model=this.getWaitersListDataModel();
var model = Ext.ModelManager.getModel('WaitersListData');
var r = Ext.ModelManager.create({
customer:'selec user',
destination:'destination',
from_date:'date',
to_date:'date',
from_cost:'date',
to_cost:'date',
hotel_stars:'date',
airline:'date',
sure:false,
visited:false


},model);
store.insert(0,r);
rowEditing.startEdit(0, 0);
}

},

scottmartin
20 Jun 2012, 8:07 AM
If you have your controller setup properly, you would not have to use Ext.ComponentQuery.query
to access the grid.

Do you have your views:[] setup in your controller?
You can also use refs

I would suggest reading this article:
http://www.sencha.com/learn/the-mvc-application-architecture/

You are trying to access an undefined object, or an object that is not the one you expected .

Scott.