猿问

datatables的Bootstrap样式的分页怎么添加首页和尾页

datatables的Bootstrap样式的分页怎么添加首页和尾页 


互换的青春
浏览 1305回答 2
2回答

慕码人2483693

其中的样式设置"sPaginationType": "bootstrap"我想个这个分页加首页和尾页,不知道怎么弄.,具体解决方案如下:解决方案1:自己修改源代码增加了,还要修改内部的事件,有得改的。解决方案2:今天也碰到该问题。自己解决了下 找到dataTables.bootstrap.js(版本3)注:此处修改为原始代码/* Jion 修改增加 首页、末页 注意修改*//* Set the defaults for DataTables initialisation */$.extend( true, $.fn.dataTable.defaults, {"sDom": "<'row'<'col-xs-6'l><'col-xs-6'f>r>t<'row'<'col-xs-6'i><'col-xs-6'p>>","sPaginationType": "bootstrap","oLanguage": {"sLengthMenu": "_MENU_ records per page"}} );/* Default class modification */$.extend( $.fn.dataTableExt.oStdClasses, {"sWrapper": "dataTables_wrapper form-inline","sFilterInput": "form-control input-sm","sLengthSelect": "form-control input-sm"} );/* API method to get paging information */$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings ){return {"iStart": oSettings._iDisplayStart,"iEnd": oSettings.fnDisplayEnd(),"iLength": oSettings._iDisplayLength,"iTotal": oSettings.fnRecordsTotal(),"iFilteredTotal": oSettings.fnRecordsDisplay(),"iPage": oSettings._iDisplayLength === -1 ?0 :&nbsp;Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),"iTotalPages": oSettings._iDisplayLength === -1 ?0 :&nbsp;Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )};};/* Bootstrap style pagination control */$.extend( $.fn.dataTableExt.oPagination, {"bootstrap": {"fnInit": function( oSettings, nPaging, fnDraw ) {var oLang = oSettings.oLanguage.oPaginate;var fnClickHandler = function ( e ) {e.preventDefault();....
随时随地看视频慕课网APP
我要回答