PDA

View Full Version : Undefined function



jop_008
23 May 2012, 2:16 AM
I took some example code to start with

//http://192.168.1.47:8080/webapp_ios/mflorence
var store= new Ext.data.JsonStore({
url:'combo.php',
root: 'data',
totalProperty: 'num',
fields: [
{name:'name', type: 'string'},
{name:'desc', type: 'string'},
{name:'logo', type: 'string'},
]
});


// creating the combo and assigning the store
var comboRemote=new Ext.form.ComboBox({

on the last line I got an error which I can not handle.

Uncaught TypeError: undefined is not a function

Thanks for help
John

jop_008
23 May 2012, 4:36 AM
Hi,

Not only with the code shown in this thread but also in other parts of the code.
It looks like the first function call and then uncaught typeerror.

At this moment I can not create one simple form to start prototyping.

var yourData = [
[1, 'item1']
,[2, 'item2']
];


var combo = new Ext.form.ComboBox({
//Uncaught TypeError: undefined is not a function
store: new Ext.data.SimpleStore({
id:0
,fields:
[
'myId', //numeric value is the key
'myText' //the text value is the value
]
,data:yourData
})
,valueField:'myId'
,displayField:'myText'
,mode:'local'
// rest of config
});

Thanks John

scottmartin
25 May 2012, 10:35 AM
Have a look at this:



{
total: 5,
data: [
{
"abbr": "AL",
"name": "Alabama",
"slogan": ""
},
{
"abbr": "AK",
"name": "Alaska",
"slogan": ""
},
{
"abbr": "AZ",
"name": "Arizona",
"slogan": ""
},
{
"abbr": "AR",
"name": "Arkansas",
"slogan": ""
},
{
"abbr": "CA",
"name": "California",
"slogan": ""
}
]
}




// create the data store
var myStore = new Ext.data.JsonStore({
url: 'states.json',
autoLoad: true,
root: 'data',
idProperty: 'state',
totalProperty: 'total',
successProperty: 'success',
fields: [
{ name: 'abbr' },
{ name: 'name' },
{ name: 'slogan' }
]
});


Ext.onReady(function() {
var combo = new Ext.form.ComboBox({
store: myStore,
displayField:'name',
valueField: 'abbr',
mode: 'local',
triggerAction: 'all',
emptyText:'Select a state...',
//autoSelect: false,
renderTo: Ext.getBody(),
loadingText: 'Loading...'
});

});


Regards,
Scott.