如何将 Dojo 原型集成到 ICN 中?
How to integrate Dojo prototype into the ICN?
我有一个模板(使用 Dojo)如下:
enter image description here
我使用 IBM 内容导航器的新功能将它集成到 ICN 中:
enter image description here
请帮忙或举个例子。
如有任何帮助,将不胜感激。
--
我的代码如下:
原型代码------------------------
------------html页数
<div class="leading-panel" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'leading'">
<p>Danh sách thông tin<br/> <input id="stateSelect"></p>
<p>Mã thông tin<br/> <input id="stateSelect2"></p>
</div><!--End .leading-panel-->
------------Js页
require([
"dojo/store/Memory", "dijit/form/ComboBox", "dojo/domReady!"
], function(Memory, ComboBox){
var stateStore = new Memory({
data: [
{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},
{name:"American Samoa", id:"AS"},
{name:"Arizona", id:"AZ"},
{name:"Arkansas", id:"AR"},
{name:"Armed Forces Europe", id:"AE"},
{name:"Armed Forces Pacific", id:"AP"},
{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},
{name:"Colorado", id:"CO"},
{name:"Connecticut", id:"CT"},
{name:"Delaware", id:"DE"}
]
});
var comboBox = new ComboBox({
id: "stateSelect",
name: "state",
style:{width: "auto"},
value: "California",
store: stateStore,
searchAttr: "name"
}, "stateSelect").startup();
var comboBox = new ComboBox({
id: "stateSelect2",
name: "state",
style:{width: "auto"},
value: "California",
store: stateStore,
searchAttr: "name"
}, "stateSelect2").startup();
});
IBM content navigator 代码的新特性------------
.com.WebContent.testICNDojo.templates
---ICNFutureTest.html
<div class="ecmCenterPane">
<!-- Please add your configuration pane -->
<div class="wrapper" data-dojo-type="dijit/layout/BorderContainer" style="width: 100%; height: 100%;">
<div class="leading-panel" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'leading'">
<p>Danh sách thông tin<br/> <input id="stateSelect"></p>
<p>Mã thông tin<br/> <input id="stateSelect2"></p>
</div><!--End .leading-panel-->
</div>
</div>
---------------------------------------- ----------
.com.WebContent.testICNDojo
---ICNFutureTest.js
define([
"dojo/_base/declare",
"ecm/widget/layout/_LaunchBarPane",
"dojo/text!./templates/ICNFutureTest.html",
"dojo/store/Memory",
"dijit/form/ComboBox",
"dojo/domReady!"
],
function(declare,
_LaunchBarPane,
template,
Memory,
ComboBox) {
/**
* @name testICNDojo.ICNFutureTest
* @class
* @augments ecm.widget.layout._LaunchBarPane
*/
return declare("testICNDojo.ICNFutureTest", [
_LaunchBarPane
], {
/** @lends testICNDojo.ICNFutureTest.prototype */
templateString: template,
widgetsInTemplate: true,
postCreate: function() {
this.inherited(arguments);
//load js for template
this.loadDataOfForm();
},
/**
* My js-------
*/
loadDataOfForm: function() {
var stateStore = new Memory({
data: [
{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},
{name:"American Samoa", id:"AS"},
{name:"Arizona", id:"AZ"},
{name:"Arkansas", id:"AR"},
{name:"Armed Forces Europe", id:"AE"},
{name:"Armed Forces Pacific", id:"AP"},
{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},
{name:"Colorado", id:"CO"},
{name:"Connecticut", id:"CT"},
{name:"Delaware", id:"DE"}
]
});
var comboBox = new ComboBox({
id: "stateSelect",
name: "state",
style:{width: "auto"},
value: "California",
store: stateStore,
searchAttr: "name"
}, "stateSelect").startup();
}
/*ect function ...*/
});
});
你应该把它放在 loadContent 函数中。 loadContent 是 CustomFeature - IBM Content Navigator 中的内置函数,例如:
loadContent: function() {
var stateStore = new Memory({
data: [
{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},
{name:"American Samoa", id:"AS"},
{name:"Arizona", id:"AZ"},
{name:"Arkansas", id:"AR"},
{name:"Armed Forces Europe", id:"AE"},
{name:"Armed Forces Pacific", id:"AP"},
{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},
{name:"Colorado", id:"CO"},
{name:"Connecticut", id:"CT"},
{name:"Delaware", id:"DE"}
]
});
var comboBox = new ComboBox({
id: "stateSelect",
name: "state",
style:{width: "auto"},
value: "California",
store: stateStore,
searchAttr: "name"
}, "stateSelect").startup();
this.logEntry("loadContent");
if (!this.isLoaded) {
this.isLoaded = true;
this.needReset = false;
}
this.logExit("loadContent");
},
我有一个模板(使用 Dojo)如下: enter image description here
我使用 IBM 内容导航器的新功能将它集成到 ICN 中: enter image description here
请帮忙或举个例子。
如有任何帮助,将不胜感激。
-- 我的代码如下:
原型代码------------------------ ------------html页数
<div class="leading-panel" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'leading'">
<p>Danh sách thông tin<br/> <input id="stateSelect"></p>
<p>Mã thông tin<br/> <input id="stateSelect2"></p>
</div><!--End .leading-panel-->
------------Js页
require([
"dojo/store/Memory", "dijit/form/ComboBox", "dojo/domReady!"
], function(Memory, ComboBox){
var stateStore = new Memory({
data: [
{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},
{name:"American Samoa", id:"AS"},
{name:"Arizona", id:"AZ"},
{name:"Arkansas", id:"AR"},
{name:"Armed Forces Europe", id:"AE"},
{name:"Armed Forces Pacific", id:"AP"},
{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},
{name:"Colorado", id:"CO"},
{name:"Connecticut", id:"CT"},
{name:"Delaware", id:"DE"}
]
});
var comboBox = new ComboBox({
id: "stateSelect",
name: "state",
style:{width: "auto"},
value: "California",
store: stateStore,
searchAttr: "name"
}, "stateSelect").startup();
var comboBox = new ComboBox({
id: "stateSelect2",
name: "state",
style:{width: "auto"},
value: "California",
store: stateStore,
searchAttr: "name"
}, "stateSelect2").startup();
});
IBM content navigator 代码的新特性------------ .com.WebContent.testICNDojo.templates ---ICNFutureTest.html
<div class="ecmCenterPane">
<!-- Please add your configuration pane -->
<div class="wrapper" data-dojo-type="dijit/layout/BorderContainer" style="width: 100%; height: 100%;">
<div class="leading-panel" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'leading'">
<p>Danh sách thông tin<br/> <input id="stateSelect"></p>
<p>Mã thông tin<br/> <input id="stateSelect2"></p>
</div><!--End .leading-panel-->
</div>
</div>
---------------------------------------- ---------- .com.WebContent.testICNDojo ---ICNFutureTest.js
define([
"dojo/_base/declare",
"ecm/widget/layout/_LaunchBarPane",
"dojo/text!./templates/ICNFutureTest.html",
"dojo/store/Memory",
"dijit/form/ComboBox",
"dojo/domReady!"
],
function(declare,
_LaunchBarPane,
template,
Memory,
ComboBox) {
/**
* @name testICNDojo.ICNFutureTest
* @class
* @augments ecm.widget.layout._LaunchBarPane
*/
return declare("testICNDojo.ICNFutureTest", [
_LaunchBarPane
], {
/** @lends testICNDojo.ICNFutureTest.prototype */
templateString: template,
widgetsInTemplate: true,
postCreate: function() {
this.inherited(arguments);
//load js for template
this.loadDataOfForm();
},
/**
* My js-------
*/
loadDataOfForm: function() {
var stateStore = new Memory({
data: [
{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},
{name:"American Samoa", id:"AS"},
{name:"Arizona", id:"AZ"},
{name:"Arkansas", id:"AR"},
{name:"Armed Forces Europe", id:"AE"},
{name:"Armed Forces Pacific", id:"AP"},
{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},
{name:"Colorado", id:"CO"},
{name:"Connecticut", id:"CT"},
{name:"Delaware", id:"DE"}
]
});
var comboBox = new ComboBox({
id: "stateSelect",
name: "state",
style:{width: "auto"},
value: "California",
store: stateStore,
searchAttr: "name"
}, "stateSelect").startup();
}
/*ect function ...*/
});
});
你应该把它放在 loadContent 函数中。 loadContent 是 CustomFeature - IBM Content Navigator 中的内置函数,例如:
loadContent: function() {
var stateStore = new Memory({
data: [
{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},
{name:"American Samoa", id:"AS"},
{name:"Arizona", id:"AZ"},
{name:"Arkansas", id:"AR"},
{name:"Armed Forces Europe", id:"AE"},
{name:"Armed Forces Pacific", id:"AP"},
{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},
{name:"Colorado", id:"CO"},
{name:"Connecticut", id:"CT"},
{name:"Delaware", id:"DE"}
]
});
var comboBox = new ComboBox({
id: "stateSelect",
name: "state",
style:{width: "auto"},
value: "California",
store: stateStore,
searchAttr: "name"
}, "stateSelect").startup();
this.logEntry("loadContent");
if (!this.isLoaded) {
this.isLoaded = true;
this.needReset = false;
}
this.logExit("loadContent");
},