It's all about the answers!

Ask a question

Custom enumeration attr with JavaScript Condition: ReadOnly


William Lucas (1823) | asked Nov 19 '13, 12:00 p.m.
The below works to effectively "hide" (i.e. so long as condition is true, editor presentation remains hidden) a String custom attribute but not so with an enumeration custom attribute.  Does the js need to change or is this behavior not supported for enumerations?  Js as follows:

dojo.provide("net.jazz.readonly.MaximoAppReadOnlyCondition.Condition");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.string");
   
(function() {   
    /*
    * Answer true (read-only condition is met) if "Application" != "Maximo"
    */
    dojo.declare("net.jazz.readonly.MaximoAppReadOnlyCondition.Condition", null, {
   
    matches: function(workItem, configuration) {
        var conditionValueTrigger_maximo= "Maximo";
        var applicationValue= workItem.getLabel("application_enumeration");       
        var result = (applicationValue != conditionValueTrigger_maximo);
        console.log("Application Name=" + applicationValue + " result=" + result);
        return result;
    }
});
})();


NOTE: When condition trigger is reached, target custom enumeration is able to have contents modified and persisted (not possible when condition not satisfied) but I want the behavior to emulate the custom String attribute presentation and not show Enumeration at all if condition not satisfied--this is a convenient way to hide the drop-down list unless a trigger condition value is met on a dependent enumeration.

I know I can populate the target's value list to "somewhat" achieve this behavior but I do not want the enum to appear unless dependent condition is satisfied to avoid confusion.


Comments
Ralph Schoon commented Nov 20 '13, 3:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This might be a defect. Hard to tell, without knowing which version of RTC you refer to, it is hard to test.


Ralph Schoon commented Nov 20 '13, 3:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

On a second thought, you are probably looking for a hide on condition which is not available yet, as far as I can tell.


Eric Jodet commented Nov 20 '13, 3:29 a.m.
JAZZ DEVELOPER

Correct Ralph,

 As far as I know there is no such support in attribute customization to hide a presentation using a custom js.
On the other hand, we provide OOTB support:
Eric


Ralph Schoon commented Nov 20 '13, 3:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I have talked to development about this as an additional feature. I am not sure there is an enhancement request though.


William Lucas commented Nov 20 '13, 8:36 p.m.

Thanks Ralph.  I am using CLM 4.0.1
Eric, none of the OOTB solutions would work for my work item as I want it to remain hidden unless user selects a specific value in another custom enumeration attr.  None of the 5 above meet the need (unless I'm missing something.)
Thanks for the information, however.
-Will

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Nov 21 '13, 3:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Wiliam,

read only is not hidden.

Read Only on condition is supported for 4.x using the condition as well as a precondition. If this does not work for a specific attribute type I would suggest to open a PMR or a defect.

Hidden on condition is not supported today, let alone in 4.0.1. I don't think there is a way around it. You might want to file an enhancement request.
William Lucas selected this answer as the correct answer

Comments
William Lucas commented Nov 21 '13, 12:43 p.m.

Yes, I understand read only is not hidden, hence my use of quotes surrounding "hide" in my original post.  I attempted to insert an image demonstrating the behavior when cust attr is string (label appears but no text box appears until condition on target is met) but as I do not have a > 60 reputation, alas, I could not.  Perhaps the way the read only condition is implemented in js on cust str atttr is a bug but if so, it is a fortuitous one since it mimics the behavior I seek.  That behavior is what I was seeking in the cust attr enum (i.e. no drop-down appearance but only label when trigger met.)  I will log an enhancement request and make arrangements to update to a newer version of CLM to get L&G fixes/enhancements.  Thank you!

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.