您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)Bootstrap如何填充Json數(shù)據(jù),小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
具體如下:
一、如圖:
二、html代碼:
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> <div class="content"> <div class="table-responsive"> <div class="container-fluid" > <div class="row-fluid"> <form class="form-inline well well-sm" id="monitor_form" role="form"> <div class="form-group pdate"> <label for="date">起日期:</label><input type="text" id="startDate" name="startDate" class="form-control layer-date" data-options="editable:false,required:true"/> <i class="iconfont"></i> </div> <div class="form-group pdate"> <label for="date">止日期:</label><input type="text" id="endDate" name="endDate" class="form-control layer-date" data-options="editable:false,required:true"/> <i class="iconfont"></i> </div> <div class="form-group"> <a href="javascript:void(0);" class="button bPrimary" id="iconsearch" ><i class="iconfont"></i>查詢</a> </div> </form> <div class="col-xs-6 nospace" > <div class="panel panel-default"> <div class="panel-heading">統(tǒng)計圖表</div> <div class="panel-body" > <img id="JPGE_pdId" src="" title='統(tǒng)計圖表' alt='統(tǒng)計圖表'/> </div> </div> </div> <div class="col-xs-6 nospace"> <div class="panel panel-default"> <div class="panel-heading">統(tǒng)計數(shù)據(jù)</div> <div class="panel-body noborder" > <!-- <table id="monitor-table" class="table-striped table-hover" data-mobile-responsive="true"></table> --> <table id="monitor-table" class="table table-striped table-hover "> <thead> <tr> <th data-field="item0">數(shù)據(jù)類型</th> <th data-field="item1">流程名稱</th> <th data-field="item2">數(shù)值</th> </tr> </thead> </table> </div> </div> </div> </div> </div> </div> </div>
三、js代碼:
<script> var $table = $("#monitor-table"); $(function(){ refFlushChart(); $("#iconsearch").click(function(){ refFlushChart(); }); }); function refFlushChart(){ var params = $("monitor_form").serialize(); var url = "${ctx}/workflow/central!monitorJPEG.action"; submitForm(params,url, function(data){ if( data.mess!=null&&data.mess.length > 0 ){ Comfirm.show("提示", data.mess); } $("#JPGE_pdId").attr("src",data.imgUrl); //var dataObj = eval("(" + JSON.stringify(data.dataGrid) + ")"); var dataObj = data.dataGrid; alert(dataObj.length); //$table.bootstrapTable('load', jQuery.parseJSON(data.dataGrid)); $.each(dataObj,function(index,item){ var $tr = $('<tr>'); $.each(item,function(name,val){ var $td = $('<td>').html(val); $tr.append($td); }); $table.append($tr); }); }); }
四、json數(shù)據(jù)格式:
{ "state": 200, "mess": "", "startDate": "2016-10-04", "endDate": "2016-11-03", "imgUrl": "/workflow/reportChart/201611/03/5e39452448594fe8a8579d1993029759.jpg", "dataGrid": [ { "item0": "開單數(shù)", "item1": "申請1", "item2": "1" }, { "item0": "開單數(shù)", "item1": "申請2", "item2": "15" } ] }
關(guān)于“Bootstrap如何填充Json數(shù)據(jù)”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。