-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRUD: display delete button for some entries only based on a condition #16
Comments
I am going to close this issue because:
If you think this is still important or there are more/new informations. Please reopen the issue and let us know. If this is a problem or a feature you like to discuss, join our slack team: slack.luya.io. We try to keep our issue tracker as clean as possible in order to focus on active issues. |
I've come up with a solution and I would like to share (already did it but with missing tests) |
Hi @rochdi80tn just create a pull request and refer to this issue if you like |
This issue has originally been reported by @kogli at luyadev/luya#1360.
Moved here by @nadar.
There is currently no way to show the delete button in ngRest CRUD for some entries only, based on a condition.
This would be useful when, for example, some entries were tied to other entries in other tables. Currently, the button is either shown or hidden for all entries.
I tried replacing
['delete', true]
with something like['delete', $this->id == 2]
, but to no avail - whenngRestScopes()
is called, values of the Model instance are not populated:$this->id
isnull
, so$this->id == 2
returnsfalse
.The text was updated successfully, but these errors were encountered: