使用jquerydatatable和bootsrap創(chuàng)建表格實(shí)例代碼

 使用jquery-datatable插件

創(chuàng)新互聯(lián)建站主要為客戶提供服務(wù)項(xiàng)目涵蓋了網(wǎng)頁視覺設(shè)計(jì)、VI標(biāo)志設(shè)計(jì)、成都全網(wǎng)營(yíng)銷推廣、網(wǎng)站程序開發(fā)、HTML5響應(yīng)式成都網(wǎng)站建設(shè)、移動(dòng)網(wǎng)站建設(shè)、微商城、網(wǎng)站托管及成都網(wǎng)站維護(hù)、WEB系統(tǒng)開發(fā)、域名注冊(cè)、國(guó)內(nèi)外服務(wù)器租用、視頻、平面設(shè)計(jì)、SEO優(yōu)化排名。設(shè)計(jì)、前端、后端三個(gè)建站步驟的完善服務(wù)體系。一人跟蹤測(cè)試的建站服務(wù)標(biāo)準(zhǔn)。已經(jīng)為廣告推廣行業(yè)客戶提供了網(wǎng)站建設(shè)服務(wù)。

bootstrap前端框架

json

一.創(chuàng)建demo.html

代碼塊

代碼塊語法遵循標(biāo)準(zhǔn)markdown代碼,例如:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://"
      + request.getServerName() + ":" + request.getServerPort()
      + path + "/";
%>
<!DOCTYPE html>
<html lang="en" class="app">
<head>
<meta charset="utf-8" />
<title>XXX服務(wù)平臺(tái)</title>
<meta name="description"
  content="app, web app, responsive, admin dashboard, admin, flat, flat ui, ui kit, off screen nav" />
<meta name="viewport"
  content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet"
  href="<%=request.getContextPath()%>/www/AL_app/js/jPlayer/jplayer.flat.css" rel="external nofollow" 
  type="text/css" />
<link rel="stylesheet"
  href="<%=request.getContextPath()%>/www/AL_app/css/bootstrap.css" rel="external nofollow" 
  type="text/css" />
<link rel="stylesheet"
  href="<%=request.getContextPath()%>/www/AL_app/css/font.css" rel="external nofollow" 
  type="text/css" />
<link rel="stylesheet"
  href="<%=request.getContextPath()%>/www/AL_app/css/app.css" rel="external nofollow" 
  type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/www/AL_app/js/datatables/datatables.css" rel="external nofollow" type="text/css"/>
<!--[if lt IE 9]>
  <script src="js/ie/html5shiv.js"></script>
  <script src="js/ie/respond.min.js"></script>
  <script src="js/ie/excanvas.js"></script>
 <![endif]-->
</head>
<body class=""
<!-- ***********醫(yī)用藥典開始************** -->
<section id="content">
     <section class="vbox">
      <section class="scrollable padder">
      <div class="m-b-md">
        <h4 class="m-b-none"></h4>
       </div>
       <div class="m-b-md">
        <h4 class="m-b-none">中醫(yī)藥典</h4>
       </div>
       <section class="panel panel-default">
        <header class="panel-heading">
         清單
         <i class="fa fa-info-sign text-muted" data-toggle="tooltip" data-placement="bottom" data-title="ajax to load the data."></i> 
        </header>
        <div class="table-responsive">
         <table class="table table-striped m-b-none" data-ride="datatables"> 
          <thead>
           <tr>
            <th  >序號(hào)</th>
            <th >藥名</th>
            <th >拼音簡(jiǎn)稱</th>
            <th >用法</th>                 
            <th >操作</th>
           </tr>       
          </thead>
          <tbody>
          </tbody>
         </table>
        </div>
       </section>
      </section>
     </section>
     <a href="#" rel="external nofollow" class="hide nav-off-screen-block" data-toggle="class:nav-off-screen,open" data-target="#nav,html"></a>
    </section>
    <!-- ***********醫(yī)用藥典結(jié)束************** -->
      </section>
    </section>
  </section>
<script src="<%=request.getContextPath()%>/www/AL_app/js/jquery.min.js"></script>
  <!-- Bootstrap -->
<script src="<%=request.getContextPath()%>/www/AL_app/js/bootstrap.js"></script>
  <!-- App -->
<script src="<%=request.getContextPath()%>/www/AL_app/js/app.js"></script>
<script type="text/javascript"
    src="<%=request.getContextPath()%>/www/AL_app/js/jPlayer/demo.js"></script>
<script src="<%=request.getContextPath()%>/www/AL_app/jh_js/jq.dataTable.js"></script>
<script src="<%=request.getContextPath()%>/www/AL_app/js/datatables/jquery.csv-0.71.min.js"></script>
<script src="<%=request.getContextPath()%>/www/AL_app/drugs/demo.js"></script>
<script src="<%=request.getContextPath()%>/www/AL_app/js/app.plugin.js"></script>
</body>
</html>

二.創(chuàng)建一個(gè)drugs.json

{
  "aaData": [
  {
    "序號(hào)": "1",
    "藥名": "白術(shù)",
    "拼音簡(jiǎn)稱": "bzh",
    "用法": "內(nèi)服",
    "操作": "編輯"
  }, 
  {
    "序號(hào)": "3",
    "藥名": "白術(shù)",
    "拼音簡(jiǎn)稱": "bzh",
    "用法": "內(nèi)服",
    "操作": "編輯"
  }, 
  {
    "序號(hào)": "4",
    "藥名": "白術(shù)",
    "拼音簡(jiǎn)稱": "bzh",
    "用法": "內(nèi)服",
    "操作": "編輯"
  }, 
  {
    "序號(hào)": "5",
    "藥名": "白術(shù)",
    "拼音簡(jiǎn)稱": "bzh",
    "用法": "內(nèi)服",
    "操作": "編輯"
  }, 
  {
    "序號(hào)": "6",
    "藥名": "白術(shù)",
    "拼音簡(jiǎn)稱": "bzh",
    "用法": "內(nèi)服",
    "操作": "編輯"
  }
]

三.創(chuàng)建一個(gè)demo.js

/** 使用jquery-datatable異步請(qǐng)求數(shù)據(jù)創(chuàng)建表格 **/
+function ($) { "use strict";
 $(function(){
 // datatable
 $('[data-ride="datatables"]').each(function() {
  var oTable = $(this).dataTable( {
   "bProcessing": true,
   "sAjaxSource": "www/AL_app/drugs/drugs.json",//異步請(qǐng)求json數(shù)據(jù)
   "sDom": "<'row'<'col-sm-6'l><'col-sm-6'f>r>t<'row'<'col-sm-6'i><'col-sm-6'p>>",
   "sPaginationType": "full",
   //給表格單元的頭信息命名
   "aoColumns": [
    { "mData": "序號(hào)" },
    { "mData": "藥名" },
    { "mData": "拼音簡(jiǎn)稱" },
    { "mData": "用法" },
    { "mData": "操作" }
   ]
  } );
 });
}(window.jQuery);

四.截圖如下所示

使用jquery datatable和bootsrap創(chuàng)建表格實(shí)例代碼
使用jquery datatable和bootsrap創(chuàng)建表格實(shí)例代碼

以上所述是小編給大家介紹的使用jquery datatable和bootsrap創(chuàng)建表格實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)創(chuàng)新互聯(lián)網(wǎng)站的支持!

文章標(biāo)題:使用jquerydatatable和bootsrap創(chuàng)建表格實(shí)例代碼
本文網(wǎng)址:http://muchs.cn/article32/piddsc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站、服務(wù)器托管、標(biāo)簽優(yōu)化網(wǎng)站內(nèi)鏈、企業(yè)建站、網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站