From 21a88a3d32e8514b7e74371255e1f81a63199b40 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Mon, 27 Nov 2023 09:46:31 +0300 Subject: [PATCH] Update FilterSortEditDoc.vue --- doc/datatable/edit/FilterSortEditDoc.vue | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) 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; } } };