vs 2010jquery easyui用datagrid控件无法显示.json中数据
在单独的.html中可以打开,可是在vs2010中,就是运行不起来。问题出在哪里???各位帮我看看,急急急!!!
html文件内容如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>jQuery EasyUI</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="../themes/icon.css"/>
<script type="text/javascript" src="../jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script type="text/javascript">
$(function(){
$('#tt').datagrid({
url: '../demo/datagrid_data2.json',
title: 'DataGrid',
width: 600,
height: 300,
fitColumns: true,
nowrap:false,
columns:[[
{field:'itemid',title:'Item ID',width:80},
{field:'productid',title:'Product ID',width:100},
{field:'listprice',title:'List Price',width:80,align:'right',
styler:function(value,row,index){
if (value < 20){
return 'background-color:#ffee00;color:red;';
}
}
},
{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
{field:'attr1',title:'Attribute',width:150},
{field:'status',title:'Status',width:60,align:'center'}
]],
rowStyler:function(index,row,css){
if (row.listprice>80){
return 'background-color:#6293BB;color:#fff;font-weight:bold;';
}
}
});
});
</script>
</head>
<body>
<h1>DataGrid - Custom Row Style</h1>
<table id="tt"></table>
</body>
</html>
[解决办法]
在项目中url: '../demo/datagrid_data2.json'会有问题,出现取不到数据的现象,请坚持路径。也可以用另一种方法实现:介个