Base solution for your next web application
Open Closed

CONDITIONAL ROW ACTIONS USING ENUM #8836


User avatar
0
alfar_re created

Hi,

With ref to #8533, I have an additional challenge. I have a row action that needs to be displayed only when two things are right

  1. The rights to perform the action and
  2. The correct status of the record

What I mean is, I have an action called 'Approve' and the entity has an Enum called 'Status' that has the following statuses 'Active, Draft, Cancelled, Expired'. So, a new record is created then it has the status 'Draft' and it hence needs to be approved to become 'Active' and to perform some background work. My challenge then is making sure that I check that the current user has rights to 'Approve' as well as check that the status is 'Draft' so as to display the row action.

Thanks in advance.


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You can check the permissions of the current user.

    abp.auth.hasPermission('Approve')
    
  • User Avatar
    0
    alfar_re created

    Great. What of the status?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Is your project Angular or JQuery ?

  • User Avatar
    0
    maliming created
    Support Team

    hi @alfar_re

    You can check its status, just like https://support.aspnetzero.com/QA/Questions/8533

    visible: function (record) {
        return record.status === 'Draft';
    }
            
    
  • User Avatar
    0
    alfar_re created

    Awesome. This was very helpful. Thank you.