• Value Picker - More options to fire the dialog

    By Serdar Basegmez 1 decade ago

    I'm sorry if there is a way already, but I couldn't find this.

    I have a value picker and I want to launch the dialog via a button. Currently it may be an image or link automatically generated within picker control.

    Some use cases may be using toolbar icon, keyboard event (told before), right click menu, onchange event of another control or onfocus event of the associated control.

    I tried a workaround but the picker control does not generate a DOM id by design. Even it generates, some browsers limit the ability to fire onclick event from another part of the context. So, a client side function associated with the control's node will solve this.

    Currently, the only workaround is putting the control inside a hidden span and copy the onclick event and put it into a button's onclick. It will not work in custom controls because the js call contains the id of the view.

    • You can generate a JS function...

      By Philippe Riand 1 decade ago

      ... that does what the generate href does.

      Cross browser event dispatching can easily be fixed, if you want to trigger a link click:

      if (!dojo.isMozilla && !dojo.isWebKit) {
        oActive.fireEvent('onclick');
      } else {
        var evClick = dojo.doc.createEvent('MouseEvents');
        evClick.initMouseEvent('click', true, true, dojo.global, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
        oActive.dispatchEvent(evClick);
      }

      • Then we only need to generate an ID...

        By Serdar Basegmez 1 decade ago

        Thanks for the tip. Currently we may get a workaround then but that anchor will not generate an DOM-ID AFAIK. We can find it with class or DOM navigation.