2016-09-30 46 views

回答

10

我已經想出對策ID喜歡和分享。 這是我的表

<table 
    id="table" 
    data-toggle="table" 
    data-pagination="true" 
    data-url="data/RegisteredVisitors.json" 
    data-show-refresh="true" 
    data-show-toggle="true" 
    data-show-columns="true" 
    data-search="true"       
    data-show-pagination-switch="true" 
    data-id-field="visitor_id" 
    data-page-list="[10, 25, 50, 100, ALL]" 
    data-show-footer="false">  
<thead> 
<tr>  
    <th data-field="visitor_id" data-checkbox="false" >#</th> 
    <th data-field="visitor_number" data-formatter="VisitorDetails">Visitor #</th> 
    <th data-field="visitor_names" data-formatter="VisitorDetails" data-sortable="true">Visitor Names</th> 
    <th data-field="phone_number" data-sortable="true">Phone Number</th> 
    <th data-field="matter_type" data-sortable="true">Matter Type</th> 
    <th data-field="office_name" data-sortable="true">Office Attending</th> 
    <th data-field="time_in" data-sortable="true">Time In</th> 
    <th data-field="time_out" data-sortable="true">Time Out</th> 
    <th data-field="last_visit" data-sortable="true">Last Visit</th> 
    <th data-formatter="TableActions">Action</th> 
</tr> 
</thead> 
</table> 

這是我的jQuery函數

function TableActions (value, row, index) { 
      return [ 
       '<a class="like" href="javascript:void(0)" title="Edit">', 
       '<i class="glyphicon glyphicon-pencil"></i>', 
       '</a> ', 
       '<a class="danger remove" href="javascript:void(0)" data-visitorserial="'+row.visitor_id+'" data-visitornames="'+row.visitor_names+'" data-visitorid="'+row.visitor_number+'" data-toggle="modal" data-target="#VisitorDelete" title="Remove">', 
       '<i class="glyphicon glyphicon-trash"></i>', 
       '</a>' 
      ].join(''); 
     } 

終於得到它運行

2
<table class="table table-hover"> 
    <thead> 
     <tr> 
      <th>Button</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td><button type="button" class="btn btn-primary">button</button></td> 
     </tr> 
    </tbody> 
</table> 
+0

我正在使用引導表庫,我已經認爲是出於兄弟感謝 –