Extjs xml 网格在 chrome、safari、mozilla firefox 中不起作用,但在 IE 中起作用?

发布于 2024-10-06 01:39:10 字数 2083 浏览 5 评论 0原文

我在一个应用程序中使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

反目相谮 2024-10-13 01:39:10

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.

情泪▽动烟 2024-10-13 01:39:10

这是因为“同源政策”。请阅读它以获得更好的解释。

it is because of the "Same origin policy". Please read it for better explanation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文