How to use dojo.ready or dojo/domReady! with EWM custom presentation?
Hello,
We've written a non-trivial custom EWM presentation for a customer which extends dijit._Widget and dijit._Templated and uses dojox.grid.DataGrid.
It has a lot of functionality which all works great except we have one issue which we are unable to solve. Sometimes the DataGrid does not render on the EWM work item tab. Sometimes we need to click the EWM work item refresh icon to get it to load. Sometimes it won't load at all - especially if go to a work item we had accessed prior to the current work item we are working on.
It seems like a classic case of needing dojo.ready or dojo/domReady! - but I cannot get these to help at all.
1 - Where in our JS code would be put the dojo.ready? I've surrounded the following code with dojo.ready but with no success:
grid.placeAt();
grid.startup();
2 - Can I use dojo/domReady! with code that is not loaded with AMD? Do I have to use AMD compatible code?
3 - Sometimes with firefox or chrome debugger I can that the grid (table) HTML code is there. But it is display=none
4 - Is any of this well-documented and I just haven't found it yet.
5 - I've looked at existing EWM JS code such as
- com.ibm.team.rtc.foundation.web.ui.views.tags.DecoratedTagWidget.js
- com.ibm.team.rtc.foundation.web.ui.views.tags.explorer.ItemBrowser.js
these do not use dojo.ready or dojo/domReady!
Any / all help is appreciated.
Thanks,
Kevin
2 answers
Comments
This is a rendering problem with the dojo.DataGrid which is not used in Work Items. the DataGrid may require dojo calls to destroy the old one and recreating it when the widget is in view. Or there is a dojo version or library incompatibility. I searched for DataGrid and found it referenced in dojox.grid library. Maybe this is being overlaid with a dojo library that does not have DataGrid.
Please keep the post to one question thread.
Comments
Hello Lawrence, thank you for your help. I've been reading and re-reading your comments above and still trying to understand what I need to change/fix.
The widget/DataGrid always fails in only one specific use case:
- If the user goes back to visit a WI that they had visited earlier in the EWM session then the widget is not rendering the DataGrid.
I have observed the following behavior:
- When a user visits a new WI during a session then the widget constructor() and postCreate() functions are called. This is expected.
- When a user visits a WI that they have previously visited during the session then the constructor() and postCreate() functions are NOT called. So, for example, assume a user navigates to WI 200, then to WI 500, and then back to WI 200. The instance of the widget that is being used for the 2nd visit to WI 200 is the one that was instantiated when the user went to WI 500. And for some unknown reason my JS code fails to placeAt() the DataGrid to the HTML template (from _Templated).
Any thoughts? Thank you!
-Kevin
if(this._isInitialized) return;
this._isInitialized = true;
this.refresh();
},
_handleWorkingCopyChange: function(parms) {
}
path: path,
event: "onchange",
listener: this,
functionName: "_handleWorkingCopyChange"
});
Is the class inheritance correct? The documentation shows...
The class attribute references either a subclass PresentationPart or AttributePart, depending of whether needsAttribute is false or true. The id is references as kind from the process specification.
The contribution in the plugin.xml looks similar to this:
<editorPresentation
id="com.ibm.team.workitem.kind.workItemList"
widget="com.ibm.team.workitem.web.ui.internal.view.editor.parts.WorkItemListPart"
needsAttribute="true" >
</editorPresentation>