Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
8 replies Latest Post - ‏2011-11-15T22:03:10Z by Stan
drdamour
drdamour
52 Posts
ACCEPTED ANSWER

Pinned topic Closing the Edit Mode in Mashup Center 1.0

‏2009-03-18T16:15:25Z |
I'm in mashup center 1.0 with a custom widget. I am trying to make a button that signals the close of edit mode, so that i can do my updates to my widget.

This is what edit mode looks like: http://farm4.static.flickr.com/3638/3365858932_59a4b06be8_o.png

i have the following code hooked to the save button:

this.SaveSettings = function() 
{ myMaxLength = this.iContext.getElementById(
"MaxCommentLength").value;   this.Configure();   this.iContext.iEvents.fireEvent(
"onModeChanged",null,
{newMode:
'view'
}); 
}


but when i click the button it looks like this: http://farm4.static.flickr.com/3551/3365858950_652eae6c97_o.png

as you can see the edit window collapsed, but it didn't go away. Also, the view mode does actually become enabled.

What am i doing wrong? how do i "close" the edit mode?
Updated on 2011-11-15T22:03:10Z at 2011-11-15T22:03:10Z by Stan
  • KrisV
    KrisV
    18 Posts
    ACCEPTED ANSWER

    Re: Closing the Edit Mode in Mashup Center 1.0

    ‏2009-03-18T21:49:39Z  in response to drdamour
    Why do you have this line of code in the edit mode: this.iContext.iEvents.fireEvent("onModeChanged",null,{newMode:'view'});

    Did you try removing that line.
    • drdamour
      drdamour
      52 Posts
      ACCEPTED ANSWER

      Re: Closing the Edit Mode in Mashup Center 1.0

      ‏2009-03-18T22:45:05Z  in response to KrisV
      i can't remove that code, because that's what signals the mode change from view to edit.

      This is the only way i can see on how to cause a mode switch.

      iWidget spec: http://www-10.lotus.com/ldd/mashupswiki.nsf/dx/iwidget-spec-v1.0.pdf/$file/iwidget-spec-v1.0.pdf - search for onModeChanged

      Also if you read the onAdd info: onAdd: This event signals that the iWidget is being added to a page. This notification is intended to allow the iWidget needing immediate user configuration to request a transition to edit mode. An example of such an iWidget would be a generic Atom feed renderer needing the URI to the feed before it can be usefully rendered. As a simple notification, it carries no predefined payload.

      which is the reverse of what i'm trying to do...

      further on page 30: The iWidget definition can include markup for the modes that it declared to support. Regardless of whether a mode change happens due to an iContext-provided means or by iWidget actions

      and the nail in the coffin: http://www-10.lotus.com/ldd/mashupswiki.nsf/dx/iwidget-primer-v1.0.pdf/$file/iwidget-primer-v1.0.pdf - page 12

      so i'm doing exactly what the doc says. If i took that code out, my edit mode wouldn't close, which is exactly what i'm trying to do.

      why did you suggest removing it?
  • SystemAdmin
    SystemAdmin
    391 Posts
    ACCEPTED ANSWER

    Re: Closing the Edit Mode in Mashup Center 1.0

    ‏2009-03-20T21:28:59Z  in response to drdamour
    Try it in this way:

    {code}this.iContext.iEvents.fireEvent("onModeChanged", null, bold"*bold*{newMode:'view'}*bold*"*bold*);{/code}
    • SystemAdmin
      SystemAdmin
      391 Posts
      ACCEPTED ANSWER

      Re: Closing the Edit Mode in Mashup Center 1.0

      ‏2009-03-20T21:29:54Z  in response to SystemAdmin
      this.iContext.iEvents.fireEvent("onModeChanged", null, "{newMode:'view'}");
      • drdamour
        drdamour
        52 Posts
        ACCEPTED ANSWER

        Re: Closing the Edit Mode in Mashup Center 1.0

        ‏2009-03-23T14:41:36Z  in response to SystemAdmin
        That suggestion did not work, it results in the same behaviour.

        I am very surprised though that it didn't just crash in the first place. is mashup center eval-ing strings to turn them into JS objects? that's crazy....
  • SystemAdmin
    SystemAdmin
    391 Posts
    ACCEPTED ANSWER

    Re: Closing the Edit Mode in Mashup Center 1.0

    ‏2009-03-23T18:37:09Z  in response to drdamour
    Please try this...
    insteadof
    this.iContext.iEvents.fireEvent("onModeChanged",null,{newMode:'view'});
    please use this;
    dojo.publish(com.ibm.mm.builder.Topics.Widget_ConfigurationFinished, http://this.iContext.widgetId);

    we fixed this limitation in eGA1.1.
    so the first option will work on 1.1 GA driver.thanks.
    • PoonamSona
      PoonamSona
      3 Posts
      ACCEPTED ANSWER

      Re: Closing the Edit Mode in Mashup Center 1.0

      ‏2011-11-15T03:39:49Z  in response to SystemAdmin
      Hi, is this issue resolved. can anyone help me with page_switch.
      I am trying to switch from one page to another using href
      • Stan
        Stan
        340 Posts
        ACCEPTED ANSWER

        Re: Closing the Edit Mode in Mashup Center 1.0

        ‏2011-11-15T22:03:10Z  in response to PoonamSona
        The switchPage widget may do what you need. A publicly available copy can be downloaded from Greenhouse. The following premalink should access the widget entry in the catalog:

        http://greenhouse.lotus.com/mashuphub/public/permalink?entryid=9244

        If you run into authentication problems you can register at:
        https://greenhouse.lotus.com/gh_next/lotusgreenhouserequests.nsf/MainDocumentSelf?openForm