只能输入纯数字和“-”,且首尾必须是数字。
^(([0-9])+(-)+([0-9])+)+$ 可纯数字,可纯英文,可数字和英文混合。
^[0-9a-zA_Z]+$ 防止DataTable 刷新时请求两次后台数据:
DataTable 共通部分封装
angular.module('app.datas')
.factory('MyDTOptionsBuilder', function (DTOptionsBuilder, $translate) {
return {
fromSource: function (source) {
return DTOptionsBuilder
.fromSource(source)
.withOption('autoWidth', true)
.withOption('scrollCollapse', true)
.withOption('sAjaxDataProp', 'data')
.withOption('aLengthMenu', [10, 25, 50])
.withOption('serverSide', true)
.withPaginationType('full_numbers')
.withLanguage({
'sEmptyTable': $translate.instant('empty'),
'sInfoEmpty': '',
'sLoadingRecords': $translate.instant('Load'),
'lengthMenu': $translate.instant('show') + ' _MENU_ ' + $translate.instant('entries'),
'info': '_START_ - _END_ ' + $translate.instant('of') + ' _TOTAL_ ' + $translate.instant('items'),
'oPaginate': {
'sNext': '',
'sPrevious': ''
}
});
}
};
});
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3156/viewspace-2802365/ ,如需转载,请注明出处,否则将追究法律责任。