Skip to content
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

Hiding create edit delete buttons based on user priveleges #1486

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MePanMsn
Copy link

@MePanMsn MePanMsn commented Sep 3, 2014

Hi,

I was developing a web app in MVC asp.net and I wanted to show/hide buttons based on a user's priveleges. The buttons access/priveleges for users are defined in a database table.

As per HIK, if we don't assign a value for createAction, it will be hidden. This is ok for create button. However, edit and delete buttons do not hide and hence a fix is required.

For below code, all 3 buttons sould hide
actions: {
'createAction': '',
'deleteAction': '',
'updateAction': ''
},

In my opinion, the shortest possible fix is to add one condition. Change required in file jquery.jtable.js version jTable 2.4.0:

in line 2535 - if updateaction is blank then no need to create empty header
if (this.options.actions.updateAction != undefined && this.options.actions.updateAction != '')

in line 2545 - if updateaction is blank then no need to create the button
if (self.options.actions.updateAction != undefined && self.options.actions.updateAction != '')

in line 3011 - if deleteaction is blank then no need to create empty header
if (this.options.actions.deleteAction != undefined && this.options.actions.deleteAction != '') {

in line 3022 - if deleteaction is blank then no need to create the buttons
if (self.options.actions.deleteAction != undefined && self.options.actions.deleteAction != '') {

Thanks.

This will add view record buttons in the jtable with only cancel button.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant