• create
• postMixInProperties
• buildRendering
• postCreate – This is where most of the widget specification customization will occur.
• startup
The filename containing the code is MyWidget.js
Cheat Sheet for creating a custom widget:
1. Create a file called <MyWidget>.js
2. Create a folder relative to the current folder called "templates"
3. Create a file called <MyWidget>.htm in the "templates" folder
4. In <MyWidget>.js, add the following:
define([
"dojo/_base/declare",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dojo/text!./templates/<MyWidget>.htm"
],
function (
declare,
_WidgetBase,
_TemplatedMixin,
template) {
return declare("<Module>.MyWidget", [_WidgetBase, _TemplatedMixin], {
//
//
buildRendering: function () {
this.inherited(arguments);
}, // End of buildRendering
// The template to use for the injected HTML
//
templateString: template
}); // End of declare
}); // End of define
Once a custom Dijit Widget has been built it can also be used inside a Coach View. To achieve
this, create a ZIP file and within that ZIP, place all the pieces of the widget such as JavaScript files,
CSS files and HTML files. Place that ZIP file in a toolkit or process app as a managed file.
Now comes the interesting part. In the "In-line JavaScript" for the new Coach View, add the
following:
var path = com_ibm_bpm_coach.getManagedAssetUrl("kolban.zip", com_ibm_bpm_coach.assetType_WEB) +
"/kolban";
console.log(path);
require({
packages: [
{
name: 'kolban',
location: path
}]});
See also:
• Creating Template-based Widgets – 1.9
Page 203
Comentários a estes Manuais