PDA

View Full Version : Select field throws Cannot call method 'getRange' of null



profunctional
21 Oct 2010, 8:42 AM
I'm following the form example and have a problem when clicking the Rank select box for the second time. The first click is fine, and I can select an item. The second click in this field throws the error:

Uncaught TypeError: Cannot call method 'getRange' of null

If I set autoDestroy : false in the rankStore it works fine. What is causing the item to be destroyed so soon?



var ranksStore = new Ext.data.JsonStore({
data : [
{ rank : 'master', title : 'Master'},
{ rank : 'padawan', title : 'Student'},
{ rank : 'teacher', title : 'Instructor'},
{ rank : 'aid', title : 'Assistant'}
],
model : 'Ranks',
autoLoad : true,
autoDestroy : true
});


var ticketFormBase = {
scroll: 'vertical',
url : 'postUser.php',
standardSubmit : false,
items: [
{
xtype: 'fieldset',
title: 'Personal Info',
instructions: 'Please enter the information above.',
defaults: {
required: true,
labelAlign: 'left'
},
items: [{
xtype: 'textfield',
name : 'name',
label: 'Name',
showClear: true,
autoCapitalize : false
}, {
xtype: 'select',
name : 'rank',
label: 'Rank',
valueField : 'rank',
displayField : 'title',
store : ranksStore
}]
}]
};