Extjs + monorail use XML to transmit data

Source: Internet
Author: User

I saw my friends in the garden introduce extjs and thought it was very beautiful. I also tried it and recorded the problems I found and Their Solutions for forgetting.

1. Use XML to pass data
When many friends in the garden introduced ext's grid, most of them used JSON to transmit data, including WCF or LINQ. if net3.5 technology is used. net2.0. You can use XML to transmit data. The advantage is that you can directly use the current WebService, or you can easily serialize the able and dataset into XML to be used by extjs.
ClientCodeExample:

1 VaR Row = Ext. Data. Record. Create ([
2 ' Name ' , // "Mapping" property not needed if it's the same as "name"
3 ' Caption ' ,
4 ' Code '
5 ]);
6 // Create the Data Store
7 VaR Store =   New Ext. Data. Store ( {
8 // Load Using HTTP
9 URL: ' Findname. rails? Id = caxu7414881 ' ,
10 // The return will be XML, so lets set up a reader
11 Reader: New Ext. Data. xmlreader ( {
12Record:'Sss'
13} , Row)
14 } );
15
16 // Create the grid
17 VaR Grid =   New Ext. Grid. gridpanel ( {
18 ID: ' Ctnpanel ' ,
19 Loadmask: True ,
20 Store: store,
21 Columns :[
22 {Header:"Name", Width:120, Dataindex:'Name', Sortable:True} ,
23 {Header:"Caption", Width:180, Dataindex:'Caption', Sortable:True} ,
24 {Header:"Code", Width:100, Dataindex:'Code', Sortable:True}
25 ],
26 Renderto: ' Searchresult ' ,
27 Width: 540 ,
28 Height: 200
29 } );
30
31 Store. Load ();

The server method can directly return XML. If monorail and datatable are used, it is also very simple: 1 Dataset DS = Sqlp. executedataset (sqlp. getsqlstringcommand (SQL ));
2 If (Ds. Tables. Count > 0 )
3 {
4 DS. Tables [ 0 ]. Tablename =   " Sss " ;
5 System. Io. stringwriter writer =   New Stringwriter ();
6 DS. Tables [ 0 ]. Writexml (writer, xmlwritemode. ignoreschema );
7 // This must be added; otherwise, it cannot be returned in XML format.
8 Response. contenttype =   " Text/XML " ;
9 Rendertext (writer. tostring ());
10 }

2. font and Style
In the CSSC of extjsui, the UI uses the 11pxfont. This shows that the Chinese language is poor. I changed the 11px in all ext_all.css to 9pt, and it seems that there is no problem.

In the grid style of extjs, use a style for the grid cells.
. X-grid3-row TD,. x-grid3-summary-row TD {Line-Height: 13px; Vertical-align: Top; padding-left: 1px; padding-Right: 1px;
-Moz-user-select: None;}
As a result, the data displayed in the grid cell cannot be selected.:-Moz-user-select: normal

In addition, I found that extjs still needs to go to http://extjs.com/to get some resources during the grid loading process. I do not know some images, but I still do not know how to solve them.

3. Firefox and IE
In extjs controls, you also need to note on IE and Firefox display. If you define the control's percentage method, the two will have different display results. There is a higher chance of success with a fixed width and height, but it is best to take a look at both at the design time.

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.