首页 > 代码库 > store学习
store学习
store学习
<script type="text/javascript"> BUI.use([‘bui/grid‘,‘bui/data‘],function(Grid,Data){ var Store = Data.Store, columns = [ {title : ‘表头1‘,dataIndex :‘a‘, width:100}, {id: ‘123‘,title : ‘表头2‘,dataIndex :‘b‘, width:100}, {title : ‘表头3‘,dataIndex : ‘c‘,width:200} ]; var store = new Store({ url : ‘2a.json‘, autoLoad:true }), grid = new Grid.Grid({ render:‘#grid‘, columns : columns, store : store }); grid.render(); }); </script>
2a.json数据
{ "result": true, "rows": [{"a":"123"},{"a":"cdd","b":"edd"},{"a":"1333","c":"eee","d":2}], "results" : 20 }
在Google浏览器下始终报错
Failed to load resource file:///E:/assets/code/demo.css Failed to load resource: No ‘Access-Control-Allow-Origin‘ header is present on the requested resource. Origin ‘null‘ is therefore not allowed access. file:///E:/zpj/bui/2a.json?start=0&pageIndex=0&_=1409586123853 XMLHttpRequest cannot load file:///E:/zpj/bui/2a.json?start=0&pageIndex=0&_=1409586123853. No ‘Access-Control-Allow-Origin‘ header is present on the requested resource. Origin ‘null‘ is therefore not allowed access. 2.9grid.html:1 event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
说是浏览器不允许跨域访问具体参见:
http://my.oschina.net/LinBandit/blog/33160
感谢作者的分析。问题完解
store学习
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。