diff --git a/doc/datatable/edit/FilterSortEditDoc.vue b/doc/datatable/edit/FilterSortEditDoc.vue index c098779b8..3297687ba 100644 --- a/doc/datatable/edit/FilterSortEditDoc.vue +++ b/doc/datatable/edit/FilterSortEditDoc.vue @@ -141,6 +141,20 @@ export default { event.preventDefault(); break; } + }, + isPositiveInteger(val) { + let str = String(val); + + str = str.trim(); + + if (!str) { + return false; + } + + str = str.replace(/^0+/, '') || '0'; + var n = Math.floor(Number(str)); + + return n !== Infinity && String(n) === str && n >= 0; } } }; @@ -215,6 +229,21 @@ const onCellEditComplete = (event) => { } }; +const isPositiveInteger = (val) => { + let str = String(val); + + str = str.trim(); + + if (!str) { + return false; + } + + str = str.replace(/^0+/, '') || '0'; + var n = Math.floor(Number(str)); + + return n !== Infinity && String(n) === str && n >= 0; +}; + <\/script> `, data: ` @@ -261,6 +290,20 @@ const onCellEditComplete = (event) => { else event.preventDefault(); break; } + }, + isPositiveInteger(val) { + let str = String(val); + + str = str.trim(); + + if (!str) { + return false; + } + + str = str.replace(/^0+/, '') || '0'; + var n = Math.floor(Number(str)); + + return n !== Infinity && String(n) === str && n >= 0; } } };