使用easy UI是為了將數(shù)據(jù)圖表化,簡(jiǎn)潔美觀,但是里面的數(shù)據(jù)一直無法刷新出來,我的代碼里面寫了兩條數(shù)據(jù),但是顯示出來的一條數(shù)據(jù)都沒有,網(wǎng)上找了好多解決方法,逐個(gè)試了一遍都沒變化,所以只好來這里求助了0.0,代碼如下<!DOCTYPE?html>
<html>
<head>
????<meta?charset="UTF-8">
????<title>easy?ui?數(shù)據(jù)如何顯示??</title>
????<link?rel="stylesheet"?type="text/css"?>
????<link?rel="stylesheet"?type="text/css"?>
????<script?type="text/javascript"?src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
????<script?type="text/javascript"?src="http://www.w3cschool.cc/try/jeasyui/jquery.easyui.min.js"></script>
????<script?type="text/javascript">
????????function?formatPrice(val,row){
????????????if?(val?<?20){
????????????????return?'<span?style="color:red;">('+val+')</span>';
????????????}?else?{
????????????????return?val;
????????????}
????????}
????????</script>
</head>
<body>
<script?type="text/javascript">
????var?dataBest?=?eval("("?+?'{?"total":2,?"rows":[{"id":1,"channel":"channel","pushfee":101,"ctime":"ctime","close":"close"},{"id":2,"channel":"channel","pushfee":102,"ctime":"ctime","close":"close"}]}'?+")");
????$(function()?{
????????$('#test').datagrid({
????????????onBeforeLoad:?function?(param)?{
????????????????var?firstLoad?=?$(this).attr("firstLoad");
????????????????if?(firstLoad?==?"false"?||?typeof?(firstLoad)?==?"undefined")
????????????????{
????????????????????$(this).attr("firstLoad","true");
????????????????????return?false;
????????????????}
????????????????return?true;
????????????},
????????????title:?"列表標(biāo)題",
????????????iconCls:?'icon-save',
????????????width:?800,
????????????height:?600,
????????????method:'get',
????????????nowrap:?false,
????????????striped:?true,
????????????url:dataBest,
????????????sortName:?'id',
????????????sortOrder:?'desc',
????????????idField:?'id',
????????????frozenColumns:?[[
????????????????{?field:?'ck',?checkbox:?true?},
????????????????{?title:?'編號(hào)',?field:?'id',?width:80,sortable:true?}
????????????]],
????????????columns:?[[
????????????????{?title:?'基本信息',?colspan:?4?},
????????????????{
????????????????????field:?'opt',?title:?'操作',?width:?100,?align:?'center',?rowspan:?4,
????????????????????formatter:?function(value,?rec)?{
????????????????????????return?'<span?style="color:red">編輯?刪除</span>';
????????????????????}
????????????????}
????????????],?[
????????????????{?field:?'channel',?title:?'渠道',??width:?120?},
????????????????{?field:?'pushfee',?title:?'推廣費(fèi)',?width:?120},
????????????????{?field:?'ctime',?title:?'注冊(cè)時(shí)間',?width:?120?},
????????????????{?field:?'close',?title:?'結(jié)算狀態(tài)',?width:?120?}
????????????]],
????????????pagination:?true,
????????????rownumbers:?true,
????????????singleSelect:?false,
????????????toolbar:?[{
????????????????text:?'添加',
????????????????iconCls:?'icon-add',
????????????????handler:?function()?{
????????????????????alert('添加數(shù)據(jù)')
????????????????}
????????????},?'-',?{
????????????????text:?'保存',
????????????????iconCls:?'icon-save',
????????????????handler:?function()?{
????????????????????alert('保存數(shù)據(jù)')
????????????????}
????????????}]
????????});
????});
</script>
<table?id="test"></table>
</body>
</html>看官網(wǎng)介紹的Url寫的是一個(gè).json文件名,這里我沒有這樣寫,而是使用了一個(gè)字符串創(chuàng)建了一個(gè)json數(shù)據(jù),直接賦值給了url,而最終的效果如下圖所示:但是無論怎樣寫,數(shù)據(jù)就是不顯示,本身對(duì)于web學(xué)習(xí)不算太系統(tǒng),現(xiàn)在做的內(nèi)容算是引用一個(gè)第三方的工具來實(shí)現(xiàn)表格數(shù)據(jù)展示,因此有點(diǎn)吃力,跪求大神指點(diǎn)0.0
在這里問下有沒有研究過easy ui的大神,數(shù)據(jù)為什么刷新不出來呢?
bestDove
2016-09-13 18:23:25