PDA

View Full Version : this.ds is undefined



Komal Vaswani
27 Dec 2010, 3:24 AM
Hi,
I have created gridpanel but whenver I set this grid in form's Item property it shows error like:

"this.ds is undefined
var state = this.ds.getSortState();"

My code is as follows:


var winRoleRegister;
var frmRoleRegister;
var rolegrid;
Ext.onReady(function() {
Ext.QuickTips.init();
gridstore = new Ext.data.JsonStore({
url : 'role.action?type=module',
remoteSort : false,
root : 'list',
idProperty : 'id',
fields : ['modname'],
autoLoad : true
});
rolegrid = new Ext.grid.GridPanel({
store:'gridstore',
columns:
[{ header:'Modules',
dataIndex:'modname'

}

]
});
frmRoleRegister = new Ext.FormPanel({
// url:'UserRegistration.action',
// method:'POST',
frame : false,
border : false,
//reader:reader,
buttonAlign : 'center',
bodyStyle : 'cellpadding:15px 15px 20px 15px 15px;',
width : 430,
labelWidth : 160,
id : 'frmRoleRegister',
items : [rolegrid],
buttonAlign : 'center',
buttons : [{
text : '<font color=#15428B size=2><b>Submit</b></font>',
id:'rolereg',
handler : function() {
var btntext = Ext.getCmp('rolereg').getText();
alert(btntext);
if(btntext == 'Update')
{
frmRoleRegister.getForm().submit({
//url :'role.action?type=update',
method : 'POST',
//params:{getrole:vname},
waitTitle : 'Checking',
waitMsg : 'Validating ....',
success : function() {
Ext.Msg.alert('Registration Successful',
'Role has been successfully registered');
});
},
failure : function(form, action) {
if (action.failureType == 'server') {
Ext.Msg.alert('Error','Registration failed due to server error');
} else { // formRegister.getForm().submit();
Ext.Msg .alert('Registration Failed','Email Id already exist or Manadatory fields are left unfilled !!!');
formRegister.getForm().reset();
}

}

});
}
else
{
frmRoleRegister.getForm().submit({
//url :'role.action?type=register',
method : 'POST',
waitTitle : 'Checking',
waitMsg : 'Validating ....',
success : function() {
Ext.Msg.alert('Registration Successful',
'Role has been successfully registered');

},
failure : function(form, action) {
if (action.failureType == 'server') {
Ext.Msg.alert('Error','Registration failed due to server error');
} else { // formRegister.getForm().submit();
Ext.Msg .alert('Registration Failed','Email Id already exist or Manadatory fields are left unfilled !!!');
formRegister.getForm().reset();
}

}
});

}

}
}

]
});


// 01. Window Register
winRoleRegister = new Ext.Window({
title : '<font color=#15428B size=4><b><center>Role Registration</center></b></font>',
id : 'winRoleRegister',
layout : 'fit',
width : 410,
height : 180,
// y: 120,
resizable : false,
closable : false,
items : [frmRoleRegister]
});
}); //end of onready

Please if somebody can help me on this issue..

Thanks,
Komal

Condor
27 Dec 2010, 3:45 AM
You want store:gridstore and not store:'gridstore'.

Komal Vaswani
27 Dec 2010, 3:50 AM
Thanks a lot...... :)
I had done such a silly mistake...
thanks once again...