The API of extjs4.0 has endless ideas and examples, but I have not provided a. Net example. How can I retrieve data from the database to form a JSON string and then bind it.
It makes me endless struggle. All kinds of errors at a loss, and various construction periods approaching...
Ext. onready (function () {Ext. define ('user', {extend: 'ext. data. model ', fields: [{type: 'string', name: 'abbr'}, {type: 'string', name: 'name'}, {type: 'string', name: 'slogan'}]}); var mystore = ext. create ('ext. data. store', {model: 'user', proxy: {type: 'ajax ', URL: "default2.aspx", // reader: {// type: 'json '//, root: 'users' //} reader: 'json'}, autoload: true}); // simple ComboBox using the Data Store var simplecombo = ext. create ('ext. form. field. combobox', {fieldlabel: 'select a single State', renderto: 'A', displayfield: 'name', width: 320, labelwidth: 130, store: mystore, querymode: 'remote', // the majority of instances are local here, and I have experienced the removal operation O (export □lead) O typeahead: true });});
There are endless troubles at the beginning... First, it is wrong whether the JSON data is single quotation marks or double quotation marks. After response, it is reported that the JSON format is incorrect...
Later, I simply deleted all the default2.aspx items and wrote the JSON string naked on it. It turned out to be easy to use (this has been entangled for three days and I have no idea how to change it, or process)
String A = "[{\" abbr \ ": \" Al \ ", \" Name \ ": \" Alabama \ ", \" slogan \": \ "the heart of Dixie \" },{ \ "abbr \": \ "Wi \", \ "Name \": \ "Wisconsin \", \ "slogan \": \ "Americas dairyland \"}] "; response. write (a); response. end (); // In this sentence, let me...
Move forward.
// Reader: {// type: 'json' //, root: 'users '//}
This is because I directly write default2.aspx
"Users": [{"abbr": "Al", "name": "Alabama", "slogan": "The Heart of Dixie" },{ "abbr ": "Wi", "name": "Wisconsin", "slogan": "Americas dairyland"}]
Or
"Success": True, "users": [{"abbr": "Al", "name": "Alabama", "slogan": "The Heart of Dixie "}, {"abbr": "Wi", "name": "Wisconsin", "slogan": "Americas dairyland"}]
None. Please advise ....