Issue Details (XML | Word | Printable)

Key: JSF_EXTENSIONS-71
Type: Bug Bug
Status: Resolved Resolved
Resolution: Incomplete
Priority: Blocker Blocker
Assignee: Ed Burns
Reporter: Ed Burns
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
jsf-extensions

Regression: jMaki Widgets not correctly re-added when DOM update happens elsewhere in the page.

Created: 18/Apr/07 07:35 AM   Updated: 18/Apr/07 08:10 AM   Resolved: 18/Apr/07 08:10 AM
Component/s: www
Affects Version/s: current
Fix Version/s: milestone 1

Time Tracking:
Not Specified

Environment:

Operating System: All
Platform: Sun


Issuezilla Id: 71
Tags:
Participants: Ed Burns


 Description  « Hide

Here's the problem.

Greg, now in jmaki.js you have:

/**

  • Load a widget
  • @param widget Object representing widget to load
    */
    this.loadWidget = function(_jmw) {
    // see if the widget has been defined.
    if (_jmaki.attributes.get(_jmw.uuid) != null) { return; }
    var targetName ="jmaki.widgets." + _jmw.name + ".Widget";
    var con = this.findObject(targetName);
    if (typeof con != "function") { logError("Could not find widget constructor for: " + targetName + ". Please make sure the widget constructor is properly defined.", document.getElementById(_jmw.uuid)); }
    var wimpl;

When I do DOM replacement of the table in which the scriptaculous
inplace editor widget instances reside, I'm ok as long as the _jmw.uuid
hasn't been encountered before. The moment I try to load one that has
already been encountered, problems result.

This is new jMaki behavior. This is not a problem on the DynaFaces side.

Ed



Ed Burns added a comment - 18/Apr/07 07:37 AM

>>>>> On Tue, 17 Apr 2007 18:41:34 -0700, Gregory Murray
<Gregory.Murray@Sun.COM> said:

GM> Hi Ed,
GM> We have an API just for this kind of thing:

GM> See the jMaki clear widgets?

GM> jmaki.clearWidgets(DOM_NODE);

GM> jMaki will find all jMaki created widgets under the DOM node:

GM> 1. jMaki will call the destroy function on the widget. A destroy
GM> function is not required but if present will remove any listeners and
GM> make sure data is synced up.
GM> 2. The widget will be div will be removed from the document.
GM> 3. The widget will be removed from the jmaki.attributes map.

GM> If you can call this before re-injecting new widgets your problem
GM> should go away. I think this is the best approach because it give the
GM> widgets the opportunity to de-register events as well. This API has
GM> been around for a few releases and is what the injector uses.

GM> Let me know if this will work, otherwise we will figure out another
GM> solution.

GM> -Greg


Ed Burns added a comment - 18/Apr/07 08:10 AM

Mark as invalid because clearWidgets() was being called.