Hiding Select xClass Ellipse and Delete xClass button in Extended classification

Hi Team,

I have created a custom method, when a user selected some value in drop down list then the xClassification relationship will get added automatically. I want to prevent the user to delete or add new xClassification properties. How to achieve this.

  • Hello,

    You can achieve this by running code like the sample below in an onFormPopulated event on your form where this xClass field exists.

    var nameOfXClassField = "xclass"; // <-- Change this to be the name of the field in your form

    // Disable the ability to add additional xClass relationships
    var xClassEllipses = getFieldByName(nameOfXClassField).getElementsByClassName("aras-field-xclasses-ellipses")[0];
    xClassEllipses.style.pointerEvents = 'none'; // disable the ability to click on this button
    xClassEllipses.children[0].style.backgroundColor = '#b3b3b3'; // change the color of the button

    // Disable the ability to delete the xClass relationship
    // We have to do this inside of a timeout because these buttons are loaded after this form event is called
    setTimeout(function() {
    var xClassDeleteButtons = getFieldByName(nameOfXClassField).getElementsByClassName("aras-field-xclasses__delete-cross");

    for (var i = 0; i < xClassDeleteButtons.length; i++)
    {
    var deleteButton = xClassDeleteButtons[i];
    deleteButton.parentElement.removeChild(deleteButton);
    }
    }, 1000); // <-- You should play around with this value to find the minimum amount of time you need to wait based on your environment

    Chris

    Christopher Gillis

    Aras Labs Software Engineer

  • Hi Chris

    Thanks for this. I was able to do it and played around the time limit to wait. For the first time during create, delete button is hided for 1st xProperty group but 2nd one is not hided. When I reopen both the delete button are hided.

    Thanks