diff --git a/packages/Webkul/Ui/src/Resources/lang/en/app.php b/packages/Webkul/Ui/src/Resources/lang/en/app.php index bbd4c7b89..44e3423c0 100755 --- a/packages/Webkul/Ui/src/Resources/lang/en/app.php +++ b/packages/Webkul/Ui/src/Resources/lang/en/app.php @@ -2,6 +2,7 @@ return [ 'datagrid' => [ 'actions' => 'Actions', + 'id' => 'Index columns have value greater than zero only', 'massaction' => [ 'mass-delete-confirm' => 'Do you really want to delete these selected :resource?', diff --git a/packages/Webkul/Ui/src/Resources/views/datagrid/table.blade.php b/packages/Webkul/Ui/src/Resources/views/datagrid/table.blade.php index 3486697af..3189dd275 100644 --- a/packages/Webkul/Ui/src/Resources/views/datagrid/table.blade.php +++ b/packages/Webkul/Ui/src/Resources/views/datagrid/table.blade.php @@ -228,6 +228,7 @@ template: '#datagrid-filters', data: () => ({ + filterIndex: @json($results['index']), gridCurrentData: @json($results['records']), massActions: @json($results['massactions']), massActionsToggle: false, @@ -338,7 +339,15 @@ if (this.type == 'string') { this.formURL(this.columnOrAlias, this.stringCondition, this.stringValue, label) } else if (this.type == 'number') { - this.formURL(this.columnOrAlias, this.numberCondition, this.numberValue, label); + indexConditions = true; + if (this.filterIndex == this.columnOrAlias && (this.numberValue == 0 || this.numberValue < 0)) { + indexConditions = false; + + alert('index columns can have values greater than zero only'); + } + + if(indexConditions) + this.formURL(this.columnOrAlias, this.numberCondition, this.numberValue, label); } else if (this.type == 'boolean') { this.formURL(this.columnOrAlias, this.booleanCondition, this.booleanValue, label); } else if (this.type == 'datetime') {