Extjs4.0 learning notes (C #. NET page generates JSON)

Source: Internet
Author: User

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 ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.