javascriptjqueryadxstudio-portals

Using Jquery, how do I change the text from a gridview table?


I'm using ADX Portal and it lets you write jquery or javascript to the backend of the pages as well as some webforms, my problem is changing the value or text from 'Suspended' and set it to 'Active' that is in a gridview table or what its called an Entity List form. The ADX prepopulate value as well as set value on save features also doesn't work so I ended going jquery but for some reason I can't seem to find any id nor class to produce my code. This is the code I found using inspect element on the browser.

<td data-type="Microsoft.Xrm.Sdk.OptionSetValue" data-attribute="statuscode" data-value='{"Value":803750000,"ExtensionData":null}'>Suspended</td>

Any help would be appreciated. Thanks


Solution

  • The strict answer to this question I think is:

    $('[data-attribute="statuscode"]:contains("Suspended")').text('Active');
    

    However, you should consider why the value is 'Suspended' in CRM and 'Active' on the portal. It would be better to have the value accurately reflected for your customers rather than having to change it every time it is displayed on a portal page with JavaScript.