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.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

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

    You can check the permissions of the current user.

    abp.auth.hasPermission('Approve')
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    alfar_re created

    Great. What of the status?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Is your project Angular or JQuery ?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • 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';
    }
            
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    alfar_re created

    Awesome. This was very helpful. Thank you.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)