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

淺析Bootstrap表格的使用

 更新時(shí)間:2016年06月23日 10:21:40   作者:逸飛  
Bootstrap - 簡(jiǎn)潔、直觀、強(qiáng)悍、移動(dòng)設(shè)備優(yōu)先的前端開發(fā)框架,讓web開發(fā)更迅速、簡(jiǎn)單。下面給大家介紹Bootstrap表格的使用的相關(guān)知識(shí),非常不錯(cuò),具有參考借鑒價(jià)值,感興趣的朋友一起學(xué)習(xí)吧

Bootstrap - 簡(jiǎn)潔、直觀、強(qiáng)悍、移動(dòng)設(shè)備優(yōu)先的前端開發(fā)框架,讓web開發(fā)更迅速、簡(jiǎn)單。下面給大家介紹Bootstrap表格的使用,一起學(xué)習(xí)吧。

先定義前端table

<table class="table table-striped table-bordered table-hover" id="expandabledatatable"></table> 

然后是JS

/*
* 初始化表格
*/
var oTable = $('#expandabledatatable').dataTable({
"sDom": "Tflt<'row DTTTFooter'<'col-sm-6'i><'col-sm-6'p>>",
"aoColumnDefs": [
{
"bSortable": false, "aTargets": [0],
"render": function (data, type, full) {
return '<i class="fa fa-plus-square-o row-details"></i>';
}
},
{ "aTargets": [1], "data": "TaskName", "title": "任務(wù)名稱" },
{ "aTargets": [2], "data": "CronExpression", "title": "表達(dá)式" },
{ "aTargets": [3], "data": "Remark", "title": "說明" },
{
"bSortable": false, "aTargets": [4], "title": "運(yùn)行狀態(tài)",
"render": function (data, type, full) {
if (full["Enabled"]==true){
return '<button type="button" class="btn btn-success btn-sm">運(yùn)行</button>';
}
else {
return '<button type="button" class="btn btn-warning btn-sm">停止</button>';
}
}
},
{
"bSortable": false, "aTargets": [5],
"render": function (data, type, full) {
return '<a href="#" class="btn btn-info btn-xs edit"><i class="fa fa-edit"></i> 編輯</a> <a href="#" class="btn btn-danger btn-xs delete"><i class="fa fa-trash-o"></i> 刪除</a>';
}
}
],
"bServerSide": true,
"sAjaxSource": "/Task/GetAllTask",
"aaSorting": [[1, 'asc']],
"aLengthMenu": [
[5, 15, 20, -1],
[5, 15, 20, "All"]
],
"iDisplayLength": 5,
"searching": false,
"bLengthChange": false,
"language": {
"sProcessing": "正在加載數(shù)據(jù)...",
"sInfoEmpty": "記錄數(shù)為0",
"sInfoFiltered": " 從 _MAX_ 條過濾",
"sZeroRecords": "沒有您要搜索的內(nèi)容",
"search": "",
"sLengthMenu": "_MENU_",
"sInfo": "從 _START_ 到 _END_ /共 _TOTAL_ 條數(shù)據(jù)",
"oPaginate": {
"sPrevious": "上一頁",
"sNext": "下一頁",
}
},
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"type": 'post',
"url": sSource,
"dataType": "json",
"data": {
aoData: JSON.stringify(aoData)
},
"success": function (resp) {
fnCallback(resp);
}
});
}
}); 

該表格的數(shù)據(jù)是從服務(wù)器端取得,所以必須配置下面這些屬性,否則無法從服務(wù)器端獲得數(shù)據(jù)

"bServerSide": true,
"sAjaxSource": "/Task/GetAllTask",
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"type": 'post',
"url": sSource,
"dataType": "json",
"data": {
aoData: JSON.stringify(aoData)
},
"success": function (resp) {
fnCallback(resp);
}
});
}

以上所述是小編給大家介紹的Bootstrap表格的使用的相關(guān)知識(shí),希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論