|
|
@ -10,33 +10,33 @@
|
|
|
|
* } );
|
|
|
|
* } );
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
$.fn.DataTable.ext.pager.bootstrap_input = function(page, pages){
|
|
|
|
$.fn.DataTable.ext.pager.bootstrap_input = function (page, pages) {
|
|
|
|
return [ 'first', 'previous', 'input', 'next', 'last' ];
|
|
|
|
return ['first', 'previous', 'input', 'next', 'last'];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main_pageButtonFunc = $.fn.DataTable.ext.renderer.pageButton.bootstrap
|
|
|
|
main_pageButtonFunc = $.fn.DataTable.ext.renderer.pageButton.bootstrap
|
|
|
|
|
|
|
|
|
|
|
|
$.fn.DataTable.ext.renderer.pageButton = $.extend( true, $.fn.DataTable.ext.renderer.pageButton,
|
|
|
|
$.fn.DataTable.ext.renderer.pageButton = $.extend(true, $.fn.DataTable.ext.renderer.pageButton,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bootstrap: function ( settings, host, idx, buttons, page, pages ) {
|
|
|
|
bootstrap: function (settings, host, idx, buttons, page, pages) {
|
|
|
|
main_pageButtonFunc(settings, host, idx, buttons, page, pages);
|
|
|
|
main_pageButtonFunc(settings, host, idx, buttons, page, pages);
|
|
|
|
|
|
|
|
|
|
|
|
input_html = '<div class="input-group">' +
|
|
|
|
input_html = '<div class="input-group">' +
|
|
|
|
'<input style="width: '+ (Math.ceil(Math.log10(pages + 1)) + 2.5) + 'em; margin-left: -1px;" '+ (pages === 1 ? 'disabled ' : '') + 'class="form-control rounded-0" type="number" min="1" max="' + pages + '">' +
|
|
|
|
'<input style="width: ' + (Math.ceil(Math.log10(pages + 1)) + 2.5) + 'em; margin-left: -1px;" ' + (pages === 1 ? 'disabled ' : '') + 'class="form-control rounded-0" type="number" min="1" max="' + pages + '">' +
|
|
|
|
'<span class="input-group-text rounded-0" id="basic-addon2"> of ' + pages + '</span>' +
|
|
|
|
'<span class="input-group-text rounded-0" id="basic-addon2"> of ' + pages + '</span>' +
|
|
|
|
'</div>'
|
|
|
|
'</div>'
|
|
|
|
|
|
|
|
|
|
|
|
input_section = $(host).find("[data-dt-idx='input']");
|
|
|
|
let input_section = $(host).find("[data-dt-idx='input']");
|
|
|
|
input_section.closest("li").prop("onclick", null).off("click");
|
|
|
|
input_section.closest("li").prop("onclick", null).off("click");
|
|
|
|
input_section.closest("li").prop("onkeypress", null).off("keypress");
|
|
|
|
input_section.closest("li").prop("onkeypress", null).off("keypress");
|
|
|
|
input_section.replaceWith(input_html);
|
|
|
|
input_section.replaceWith(input_html);
|
|
|
|
|
|
|
|
|
|
|
|
const api = new DataTable.Api(settings);
|
|
|
|
const api = new DataTable.Api(settings);
|
|
|
|
|
|
|
|
|
|
|
|
$(host).find("ul.pagination input").val(page + 1).on('change', function(e){
|
|
|
|
$(host).find("ul.pagination input").val(page + 1).on('change', function (e) {
|
|
|
|
api.page(Number($(e.target).val()) - 1).draw('page');
|
|
|
|
api.page(Number($(e.target).val()) - 1).draw('page');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|