Home > front end >  Extjs json to read text files
Extjs json to read text files

Time:10-27

Beginners extjs, want to read a local json files to the grid, but how to try all not line, form displayed but countless according to
Code:
The function mess () {
Ext. Define (' User '{
The extend: 'Ext data. The Model',
Fields: [" xh jg_num ", ""," jg_mc "]
});
Var mystore=Ext create (' Ext. Data. Store ', {
Model: 'User',
Proxy: {
Type: 'ajax,
Url: '/js/yd_sf. Json,
Reader: {
Type: 'json,
Model: 'User',
Root: 'RECORDS'
}
},
AotoLoad: true
});
Var grid=new Ext grid. GridPanel ({
Title: "the GRid form test,"
Width: 800,
Height: 300,
Store: mystore,
ColumnLine: true,
RenderTo: Ext getBody (),
The columns: [{
Header: "serial number", dadaIndex: xh},
{the header: "institutions", dataIndex: "jg_num"},
{the header: "name", dataIndex: "jg_mc", width: 300},
//height: 200,
Tbar: [
{xtype: 'textfield, name: "name"},
{text: 'query', name:} 'select', '-'
{the text: 'new', name: 'add'},
{the text: "closed", width: 80}
]
});


};
Ext onReady (function () {
Mess ();
});
=========================================
The corresponding json file format for:
{
"RECORDS:" [
{
"Xh" : 1,
"Jg_num" : "175695855",
"Jg_mc" : "comprehensive investment zone,"
"Server_num" : "9371337507177",
"Je" : 3990.00
},
{
"Xh" : 2,
"Jg_num" : "175695856",
"Jg_mc" : "west ring comprehensive industry,"
"Server_num" : "903713719795",
"Je" : 3733.00
},
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- & gt; Don't stick on more came up, the above is one of the two


Thank you very much!

CodePudding user response:

AotoLoad: true
=====& gt;
AutoLoad: true

Did you release? Don't wait for its core with chrome browser, no allow access to a local file, but did not release sites don't use url: '/ js/yd_sf json ',

The path to relative path.. And/or js/XXX. Json to locate the path

Release site check server adds json file mime mapping: no, no is 404, does not support json file, such as iis 6 to the json files is not supported by default, the need to add 4 mime

CodePudding user response:

reference 1st floor showbo response:
aotoLoad: true
=====& gt;
AutoLoad: true

Did you release? Don't wait for its core with chrome browser, no allow access to a local file, but did not release sites don't use url: '/ js/yd_sf json ',

The path to relative path.. And/or js/XXX. Json to locate the path

Release site check server adds json file mime mapping: no, no is 404, does not support json file, such as iis 6 to the json files is not supported by default, the need to add a mime:

Thank you, but I changed my path "js/yd_zf jsom" or no data to show!
Didn't release application, just on the local machine test, extjs does not support read local json file you say? Attachment: picture screenshots

CodePudding user response:

Haven't release is issued, value through the file view, not via HTTP to view, his open f12 ie11 debugging tools to see what error console report, json file path is correct

CodePudding user response:

Using tomcat, useless iis

reference showbo reply: 3/f
has issued, no release is value by the file view, not via HTTP to view, his open f12 ie11 debugging tools to see what error console report, json file path is properly

Thank you very much for the keen moderators solutions
I look for them

CodePudding user response:

How do you access to data that feil protocol

CodePudding user response:

Browser to directly access the json file and see if it is correct
  •  Tags:  
  • Ajax
  • Related