PDA

View Full Version : issue with combobox not displaying data from JSON



amayak
9 Aug 2010, 9:14 AM
Hi this starts driving me crazy. I tried tons of ways to do this and nothing, same issue.

When I populate combo with data store it seems like I do get something since combobox drops down and you can kind o select empty narrow spaces, but not the actual data I assigned to it.

here is js code


Ext.onReady(function(){


var mnfg = new Ext.data.Store({
reader: new Ext.data.JsonReader({
fields: ['DEALER_ID', 'DESCRIPTION', 'DS','MFG_ACCOUNT_ID'],
root: 'DATA'
}),
proxy: new Ext.data.HttpProxy({
url: 'forms.cfm'
}),
autoLoad: true

});


var movie_form = new Ext.FormPanel({
url: 'movie-form-submit.php',
renderTo: document.body,
frame: true,
title: 'Crowley Marine Parts Catalog',
width: 500,
items: [{
xtype: 'combo',
name: 'manufacture',
fieldLabel: 'Manufaturer',
mode: 'local',
store: mnfg,
displayField:'DESCRIPTION',
width: 320}

]
});
});This is the response I get from cmf script

{"COLUMNS":["DEALER_ID","DESCRIPTION","DS","MFG_ACCOUNT_ID"],"DATA":[[1,"Mercury, Mercruiser, Force, etc.","mercury",2],[1,"OMC, Johnson & Evinrude","brp",1],[1,"Yamaha","yamaha",10]]}
Here is my HTML file


<html>
<head>
<title>Introduction to Ext 2.0: Starter Page</title>

<!-- Include Ext and app-specific scripts: -->
<script type="text/javascript" src="../ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext/ext-all-debug.js"></script>
<script type="text/javascript" src="forms.js"></script>
<!-- Include Ext stylesheets here: -->
<link rel="stylesheet" type="text/css" href="../ext/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="../ext/resources/css/structure/combo.css">


</head>
<body>

</body>
</html>And here what I end up with
21859

Am I missing something, Please, any Help !!!!!!!!!!!!!

j_mmontero
9 Aug 2010, 11:11 AM
Need to work on your JSON object.


{"COLUMNS":
["DEALER_ID","DESCRIPTION","DS","MFG_ACCOUNT_ID"],
"DATA":[

{"DEALER_ID" : 1, "DESCRIPTION": "Mercury, Mercruiser, Force, etc.", "DS" :"mercury","MFG_ACCOUNT_ID": 2},
{"DEALER_ID" : 1, "DESCRIPTION": "OMC, Johnson & Evinrude", "DS" :"brp","MFG_ACCOUNT_ID": 1},
{"DEALER_ID" : 1, "DESCRIPTION": "Yamaho", "DS" :"Yamaha","MFG_ACCOUNT_ID": 10}
]
}

Don't forget config

triggerAction: 'all'