@beenotung/tslib
Version:
utils library in Typescript
31 lines (30 loc) • 835 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.initDatatable = initDatatable;
const defaultOption = {
lengthOptions: [10, 25, 50, -1],
searchPlaceholder: 'Search records',
allText: 'All',
};
function initDatatable(e, option) {
option = Object.assign({}, defaultOption, option);
$(e).DataTable({
pagingType: 'full_numbers',
lengthMenu: [
option.lengthOptions,
option.lengthOptions.map(x => {
if (x !== -1) {
return x;
}
else {
return option.allText;
}
}),
],
responsive: true,
language: {
search: '_INPUT_',
searchPlaceholder: option.searchPlaceholder,
},
});
}