欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

bootstrap table動(dòng)態(tài)加載數(shù)據(jù)示例代碼

 更新時(shí)間:2017年03月25日 11:44:33   作者:Foolish_nick  
本篇文章主要介紹了bootstrap table動(dòng)態(tài)加載數(shù)據(jù)示例代碼,可以實(shí)現(xiàn)點(diǎn)擊選擇按鈕,彈出模態(tài)框,加載出關(guān)鍵詞列表,有興趣的可以了解一下。

我最近在研究bootstrap的學(xué)習(xí)路上,那么今天也算個(gè)學(xué)習(xí)筆記吧!

效果如下:

點(diǎn)擊選擇按鈕,彈出模態(tài)框,加載出關(guān)鍵詞列表

TABLE樣式:

<div class="modal fade " id="ClickModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
 <div class="modal-dialog"> 
 <div class="modal-content"> 
<div class="modal-header"><button onclick="colseClickModal()" class="close" type="button" data-dismiss="modal">×</button>
<h2 id="myModalLabel">關(guān)鍵詞表</h2>
</div>
<div class="modal-body" style="height:310px">
<table class="table table-hover"id="ClickTable"  > 
  <thead> 
           <tr>                              
             <th id="gjc" data-field="ID" data-sortable="true"> 
                 關(guān)鍵詞 <a style="color:red">(雙擊選擇)</a>
             </th> 
             <th data-field="REQUESTCONETENT" > 
                請(qǐng)求內(nèi)容 
             </th>          
           </tr> 
         </thead> 
</table> 
 </div>
<div class="modal-footer">
<a href="JavaScript:void(0)" rel="external nofollow" onclick="colseClickModal()" class="btn">關(guān)閉</a>

</div>
 </div>
</div>
</div>

JAVASCRIPT腳本:

   function chooseBtn1(){
      $.ajax({
      type:"POST",
      url:'wxgl/findKey',
      success:function(data){
        var dataJson = eval('(' + data + ')');
        var datalist = dataJson.keys;
        $('#ClickTable').bootstrapTable('destroy').bootstrapTable({  //'destroy' 是必須要加的==作用是加載服務(wù)器//  //數(shù)據(jù),初始化表格的內(nèi)容Destroy the bootstrap table.
          data:datalist,   //datalist 即為需要的數(shù)據(jù)
          dataType:'json',
          data_locale:"zh-US",  //轉(zhuǎn)換中文 但是沒有什么用處
          pagination: true,
          pageList:[],
          pageNumber:1,
          pageSize:5,//每頁顯示的數(shù)量
          paginationPreText:"上一頁",
          paginationNextText:"下一頁",
          paginationLoop:false,
     //這里也可以將TABLE樣式中的<tr>標(biāo)簽里的內(nèi)容挪到這里面:
        columns: [{
           checkbox: true
         },{
           field: 'ID',
           title:'關(guān)鍵詞 ',
           valign: 'middle',
         },{
         field: 'REQUESTCONETENT',
         title:'請(qǐng)求內(nèi)容'
         }]
          onDblClickCell: function (field, value,row,td) {       
            console.log(row); 
            $('#msgId').val(row.ID);
            $('#ClickModal').modal('hide');
           } 
        });
         $('#ClickModal').modal('show');
      },error:function(data){
        Modal.confirm({title:'提示',msg:"刷新數(shù)據(jù)失敗!"});
      }
      
    })
     
   }

在腳本中調(diào)用的findKey方法:

   @RequestMapping(value="findKey")
@ResponseBody
public void findKey(HttpServletResponse response,HttpServletRequest request) throws IOException{
        List<Key> keys = null; 
        keys=menuService.findKey(wxid);
        Map<String, Object> jsonMap = new HashMap<String, Object>();// 定義map
jsonMap.put("keys", keys);// rows鍵 存放每頁記錄 list
JSONObject result = JSONObject.fromObject(jsonMap);// 格式化result
response.setContentType("text/html;charset=utf-8");
PrintWriter writer = response.getWriter();
writer.write(result.toString());
writer.flush();
}

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論