<!-- 引入EasyUI组件库 -->
<script type=\"text/javascript\" src=\"jquery.min.js\"></script>
<script type=\"text/javascript\" src=\"jquery.easyui.min.js\"></script>
<!-- 创建Datagrid -->
<table id=\"dg\"></table>
<script type=\"text/javascript\">
$('#dg').datagrid({
url: 'datagrid_data.json',
columns:[[
{field:'name',title:'姓名',width:100},
{field:'age',title:'年龄',width:100,align:'right'},
{field:'address',title:'地址',width:200}
]]
});
</script>
<!-- 创建Datagrid -->
<table id=\"dg\" class=\"easyui-datagrid\" style=\"width:100%;height:400px\"
url=\"datagrid_data.json\"
toolbar=\"#toolbar\"
rownumbers=\"true\"
pagination=\"true\"
fitColumns=\"true\"
singleSelect=\"true\">
<thead>
<tr>
<th field=\"name\" width=\"50\">Name</th>
<th field=\"state\" width=\"50\">State</th>
<th field=\"salary\" width=\"50\">Salary</th>
<th field=\"date\" width=\"50\">Date</th>
</tr>
</thead>
</table>
<script type=\"text/javascript\">
$(document).ready(function(){
var themeName = \"myCustomizedTheme\";
$.parser.parse($('#dg')); //解析datagrid
$(\"#dg\").datagrid({
theme: themeName
});
setTheme(themeName); //设置主题
});
function setTheme(name){
var links = $(\"head\").find(\"link\");
for(var i=0; i<links.length; i++){
var css = $(links[i]).attr(\"href\").replace(/easyui\\/themes\\/.*?\\//g, \"easyui/themes/\"+name+\"/\");
$(links[i]).attr(\"href\", css);
}
}
</script>