在學(xué)習(xí)bootstrap-table時(shí)遇到不能顯示列篩選和分頁(yè)每頁(yè)顯示行數(shù),點(diǎn)擊的時(shí)候完全沒反應(yīng)。有沒有大神能幫忙解答一下?
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
var clients = [];
$(function () {
clients = clientsInit();
//1.初始化Table
var oTable = new TableInit();
oTable.Init();
})
function btn_add() {
$.modalOpen({
id: "Form",
title: "新增用戶",
url: "/SystemManage/User/Form",
width: "700px",
height: "510px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
function clientsInit() {
var dataJson = {
dataItems: [],
organize: [],
role: [],
duty: [],
user: [],
authorizeMenu: [],
authorizeButton: []
};
var init = function () {
$.ajax({
url: "/ClientsData/GetClientsDataJson",
type: "get",
dataType: "json",
async: false,
success: function (data) {
dataJson.dataItems = data.dataItems;
dataJson.organize = data.organize;
dataJson.role = data.role;
dataJson.duty = data.duty;
dataJson.authorizeMenu = eval(data.authorizeMenu);
dataJson.authorizeButton = data.authorizeButton;
}
});
}
init();
return dataJson;
}
var TableInit = function () {
var oTableInit = new Object();
//初始化Table
oTableInit.Init = function () {
$('#gridList').bootstrapTable({
url: '/SystemManage/User/GetGridJson', //請(qǐng)求后臺(tái)的URL(*)
method: 'get', //請(qǐng)求方式(*)
toolbar: '#toolbar', //工具按鈕用哪個(gè)容器
striped: true, //是否顯示行間隔色
cache: false, //是否使用緩存,默認(rèn)為true,所以一般情況下需要設(shè)置一下這個(gè)屬性(*)
pagination: true, //是否顯示分頁(yè)(*)
sortable: false, //是否啟用排序
sortOrder: "asc", //排序方式
queryParams: oTableInit.queryParams,//傳遞參數(shù)(*)
sidePagination: "server", //分頁(yè)方式:client客戶端分頁(yè),server服務(wù)端分頁(yè)(*)
pageNumber: 1, //初始化加載第一頁(yè),默認(rèn)第一頁(yè)
pageSize: 25, //每頁(yè)的記錄行數(shù)(*)
pageList: [10, 25, 50, 100], //可供選擇的每頁(yè)的行數(shù)(*)
search: true, //是否顯示表格搜索,此搜索是客戶端搜索,不會(huì)進(jìn)服務(wù)端,所以,個(gè)人感覺意義不大
strictSearch: true,
showColumns: true, //是否顯示所有的列
showRefresh: true, //是否顯示刷新按鈕
minimumCountColumns: 2, //最少允許的列數(shù)
clickToSelect: true, //是否啟用點(diǎn)擊選中行
height: $(window).height() - 40, //行高,如果沒有設(shè)置height屬性,表格自動(dòng)根據(jù)記錄條數(shù)覺得表格高度
//uniqueId: "ID", //每一行的唯一標(biāo)識(shí),一般為主鍵列
showToggle: true, //是否顯示詳細(xì)視圖和列表視圖的切換按鈕
cardView: false, //是否顯示詳細(xì)視圖
detailView: false, //是否顯示父子表
queryParamsType : "undefined",
columns: [{
checkbox: true
}, {
field: 'F_Id',
title: '主鍵'
}, {
field: 'F_Account',
title: '賬戶'
}, {
field: 'F_RealName',
title: '姓名'
}, {
field: 'F_Gender',
title: '性別',
formatter: function (value, row, index) {
if (value == '1') {
return '男';
} else {
return '女';
}
}
}, {
field: 'F_MobilePhone',
title: '手機(jī)',
}, {
field: 'F_OrganizeId',
title: '公司',
formatter: function (cellvalue, options, rowObject) {
return top.clients.organize[cellvalue] == null ? "" : top.clients.organize[cellvalue].fullname;
}
}, {
field: 'F_DepartmentId',
title: '部門',
formatter: function (cellvalue, options, rowObject) {
return top.clients.organize[cellvalue] == null ? "" : top.clients.organize[cellvalue].fullname;
}
}, {
field: 'F_DutyId',
title: '崗位',
formatter: function (cellvalue, options, rowObject) {
return top.clients.duty[cellvalue] == null ? "" : top.clients.duty[cellvalue].fullname;
}
}, {
field: 'F_CreatorTime',
title: '創(chuàng)建時(shí)間',
}, {
field: 'F_EnabledMark',
title: '允許登錄',
}, {
field: 'F_Description',
title: '備注',
}, ]
});
};
//得到查詢的參數(shù)
oTableInit.queryParams = function (params) {
var temp = { //這里的鍵的名字和控制器的變量名必須一直,這邊改動(dòng),控制器也需要改成一樣的
pagesize: params.pageSize, //頁(yè)面大小
page: params.pageNumber, //頁(yè)碼
sord:params.sortOrder,
sidx: 'F_DepartmentId asc,F_CreatorTime desc' //排序列
//departmentname: $("#txt_search_departmentname").val(),
//statu: $("#txt_search_statu").val()
};
return temp;
};
return oTableInit;
};
</script>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="topPanel">
<div id="toolbar">
<button id="btn_add" type="button" class="btn btn-white" data-toggle="modal" data-target="#myModal" onclick="btn_add()">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
</button>
</div>
</div>
<div class="gridPanel">
<table id="gridList"></table>
<div id="gridPager"></div>
</div>
</div>
<!-- 全局js -->
<script src="~/Content/hplus/js/jquery.min.js?v=2.1.4"></script>
<script src="~/Content/hplus/js/bootstrap.min.js?v=3.3.6"></script>
<script src="~/Content/js/framework-ui.js"></script>
<!-- 自定義js -->
<script type="text/javascript" src="~/Content/hplus/js/contabs.js"></script>
<script src="~/Content/hplus/js/content.js?v=1.0.0"></script>
<!-- Bootstrap table -->
<script src="~/Content/hplus/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="~/Content/hplus/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="~/Content/hplus/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<!-- Peity -->
<script src="~/Content/hplus/js/demo/bootstrap-table-demo.js"></script>
我也遇到了這個(gè)問題,我是將bootstrap.js刪除了才解決的。我懷疑與剩下的某個(gè)文件有沖突,(重點(diǎn)懷疑bootstrap-table.js)才造成了問題,
附上正常時(shí)引用的文件名
<script type="text/javascript" src="${ctx}/static/js/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="${ctx}/static/js/popper.min.js"></script>
<script type="text/javascript" src="${ctx}/static/js/bootbox.min.js"></script>
<script type="text/javascript" src="${ctx}/static/js/bootstrap-table.js"></script>
<script type="text/javascript" src="${ctx}/static/js/common.js"></script>
<script type="text/javascript"src="${ctx}/static/js/bootstrap-table-zh-CN.min.js"></script>
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國(guó)家
北大青鳥中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機(jī)構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團(tuán),成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫(kù),具有快速界面開發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁(yè)制作和網(wǎng)頁(yè)游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問,美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。