Extjs xml 网格在 chrome、safari、mozilla firefox 中不起作用,但在 IE 中起作用?
我在一个应用程序中使用 extjs,但是当我验证一些示例(例如 xml grid)时,我发现它在 chrome 和上面提到的其他一些浏览器中不起作用,但在 ie 中工作正常......
你能帮我解决这个问题吗?问题......这是代码......以防万一......
Ext.onReady(function(){
var store = new Ext.data.Store({
url: 'http://dev.sencha.com/deploy/dev/examples/grid/sheldon.xml',
reader: new Ext.data.XmlReader({
record: 'Item',
id: 'ASIN',
totalRecords: '@total'
}, [
{name: 'Author', mapping: 'ItemAttributes > Author'},
'Title', 'Manufacturer', 'ProductGroup'
])
});
// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "Author", width: 120, dataIndex: 'Author', sortable: true},
{header: "Title", width: 180, dataIndex: 'Title', sortable: true},
{header: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
{header: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
],
renderTo:'example-grid',
width:540,
height:200
});
store.load();
});
它的html文件是:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>XML Grid Example</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ext-all-debug.js"></script>
<script type="text/javascript" src="xml-grid.js"></script>
<link rel="stylesheet" type="text/css" href="grid-examples.css" />
<link rel="stylesheet" type="text/css" href="../shared/examples.css" />
</head>
<body>
<script type="text/javascript" src="../shared/examples.js"></script>
<h1>XML Grid Example</h1>
<div id="example-grid"></div>
</body>
</html>
i was using extjs for an application but when i verified some of the examples like xml grid, i found that it's not working in chrome and some other browsers as mentioned above but it works fine in ie...
can you please help me solve this issue....here is the code..just in case......
Ext.onReady(function(){
var store = new Ext.data.Store({
url: 'http://dev.sencha.com/deploy/dev/examples/grid/sheldon.xml',
reader: new Ext.data.XmlReader({
record: 'Item',
id: 'ASIN',
totalRecords: '@total'
}, [
{name: 'Author', mapping: 'ItemAttributes > Author'},
'Title', 'Manufacturer', 'ProductGroup'
])
});
// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "Author", width: 120, dataIndex: 'Author', sortable: true},
{header: "Title", width: 180, dataIndex: 'Title', sortable: true},
{header: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
{header: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
],
renderTo:'example-grid',
width:540,
height:200
});
store.load();
});
the html file for it is:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>XML Grid Example</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ext-all-debug.js"></script>
<script type="text/javascript" src="xml-grid.js"></script>
<link rel="stylesheet" type="text/css" href="grid-examples.css" />
<link rel="stylesheet" type="text/css" href="../shared/examples.css" />
</head>
<body>
<script type="text/javascript" src="../shared/examples.js"></script>
<h1>XML Grid Example</h1>
<div id="example-grid"></div>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Firefox、Chrome 和 Safari 可能会阻止您的 JavaScript 调用“http://dev.sencha.com/deploy/dev/examples/grid/sheldon.xml”。
将 XML 下载到您的计算机并调整商店声明中的 URL。
Firefox, Chrome and Safari probably prevent your JavaScript from calling 'http://dev.sencha.com/deploy/dev/examples/grid/sheldon.xml'.
Download the XML to your machine and adjust the URL in your store declaration.
这是因为“同源政策”。请阅读它以获得更好的解释。
it is because of the "Same origin policy". Please read it for better explanation.