Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  onChange event on a dropdown in ICN

    Posted Sun October 11, 2020 06:44 AM

    Greetings,

    On the add document screen in ICN we have a dropdown "Country". Depending upon the value choosen by the user in "Country" dropdown there are other depending dropdowns "State" and "City" which gets populated through EDS.

    I need to show a confirmation dialog to the user when the value in "Country" dropdown to changed. If user selects Yes the value should be changed if user selects on the confirmation dialog then old value should be preserved.

    To accomplish this, I tried to override the "onChange" function of ecm/widget/AddContentItemPropertiesPane. This function is actually called after the value is actually changed in the dropdown due to which on the click of cancel button in confirmation dialog I was again setting the previous value in "Country" field.

    This creates a problem if the user had selected "Country", "State" and "City" value then user changes the value in "Country" field then through code I set previous values of all 3 fields but as State and City dropdowns are populated using EDS thats why choicelist values are not retrieved and code sets the values before EDS populates those values.

    How can I address this issue ? Is there an event which is called before the value is actually set in the country dropdown and I can return false or something

    Please suggest



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: onChange event on a dropdown in ICN

    Posted Mon October 12, 2020 09:44 AM

    Hi,

    The drop down editor is ecm.widget.FilteringSelect. When user changes the value, function dijit.form._AutoCompleterMixin._selectOption() is called as handler of onChange event.

    this.dropDown = new dropDownConstructor({ onChange: lang.hitch(this, this._selectOption), id: popupId, dir: this.dir, textDir: this.textDir });

    If you want to prompt a confirmation dialog for the option changes, you may overwrite the _selectOption() function like below.

    FilteringSelect.prototype._selectOption = function(/*DomNode*/ target) { // summary: // Menu callback function, called when an item in the menu is selected. var self = this; var dialog = new ecm.widget.dialog.ConfirmationDialog({ text: "Change the value to " + target.innerHTML + "?", buttonLabel: "Yes", title: "Confirm the change", cancelButtonDefault: true, onExecute: function() { self.closeDropDown(); if(target){ self._announceOption(target); } self._setCaretPos(self.focusNode, self.focusNode.value.length); self._handleOnChange(self.value, true); // Remove aria-activedescendant since the drop down is no loner visible // after closeDropDown() but _announceOption() adds it back in self.focusNode.removeAttribute("aria-activedescendant"); }, onCancel: function() { self.closeDropDown(); } }); dialog.show(); };

    That overrides dijit.form._AutoCompleterMixin._selectOption() function.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 3.  RE: onChange event on a dropdown in ICN

    Posted Tue October 13, 2020 04:19 AM

    Thanks Angie for the answer.


    I tried to put an aspect for extending the _selectOption function but the function didn't called and I didn't got the alert


    aspect.around(FilteringSelect.prototype, "_selectOption", function (target) {

    alert("in function");

    });


    I added ecm.widget.FilteringSelect to the require statements.

    I wrote the above code in Main JS file of ICN Plugin and I am using ICN 3.0.8 IF001


    Is it not how it should be done . Please suggest



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 4.  RE: onChange event on a dropdown in ICN

    Posted Tue October 13, 2020 04:19 AM

    Thanks Angie for the answer.


    I tried to put an aspect for extending the _selectOption function but the function didn't called and I didn't got the alert


    aspect.around(FilteringSelect.prototype, "_selectOption", function (target) {

    alert("in function");

    });


    I added ecm.widget.FilteringSelect to the require statements.

    I wrote the above code in Main JS file of ICN Plugin and I am using ICN 3.0.8 IF001


    Is it not how it should be done . Please suggest



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 5.  RE: onChange event on a dropdown in ICN

    Posted Tue October 13, 2020 07:32 AM

    Hi,

    Did the sample code work for you? I'm not sure about using aspect.around to replace the function. It does not fire in my testing. You may refer to https://dojotoolkit.org/reference-guide/1.10/dojo/aspect.html or ask questions for dojo https://dojotoolkit.org/community/.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration