我創建了一個自定義頁面,列出了所有打開的工作流程。我遵循了一個Jeff Potts的教程,這個教程迄今爲止已經得到了我的幫助,但我現在試圖將我的表格變成一張更加動態的表格,但沒有取得任何成功。Alfresco dojo/jquery searchable/sortable表
小部件的js文件看起來像這樣
define(["dojo/_base/declare",
"dijit/_WidgetBase",
"alfresco/core/Core",
"alfresco/core/CoreXhr",
"dojo/dom-construct",
"dojo/_base/array",
"dijit/_TemplatedMixin",
"dojo/text!./templates/AjaxWidget.html",
],
function(declare, _Widget, Core, AlfCoreXhr, domConstruct, array, _Templated, template) {
return declare([_Widget, Core, AlfCoreXhr, _Templated], {
templateString: template,
cssRequirements: [{cssFile:"./css/AjaxWidget.css"}],
i18nRequirements: [ {i18nFile: "./i18n/AjaxWidget.properties"} ],
buildRendering: function example_widgets_AjaxWidget__buildRendering() {
this.widgetTitle = this.message('widgetTitle');
this.columnName = this.message('columnName');
this.columnDescription = this.message('columnDescription');
this.inherited(arguments);
},
postCreate: function example_widgets_AjaxWidget__postCreate() {
var url1 = Alfresco.constants.PROXY_URI + "api/people";
this.serviceXhr({url : url1,
method: "GET",
successCallback: this._getTasksPerUser,
callbackScope: this});
},
_getTasksPerUser: function example_widgets_AjaxWidget__getTasksPerUser(response, config) {
var parentNode = this.containerNode;
var wfUsers = [];
array.forEach(response.people, function(person) {
wfUsers.push(person.userName);
});
for (var wfUser in wfUsers) {
var url2 = Alfresco.constants.PROXY_URI + "api/task-instances?authority=" + wfUsers[wfUser];
this.serviceXhr({url : url2,
method: "GET",
successCallback: this._onSuccessCallback,
callbackScope: this});
}
},
_onSuccessCallback:
function example_widgets_AjaxWidget__onSuccessCallback(response, config) {
var parentNode = this.containerNode;
array.forEach(response.data, function(item) {
var row = domConstruct.create("tr", {}, parentNode);
domConstruct.create("td", { innerHTML: item.workflowInstance.id }, row);
domConstruct.create("td", { innerHTML: item.workflowInstance.message }, row);
domConstruct.create("td", { innerHTML: item.state }, row);
domConstruct.create("td", { innerHTML: item.properties.bpm_dueDate }, row);
domConstruct.create("td", { innerHTML: item.workflowInstance.initiator.firstName + " " + item.workflowInstance.initiator.lastName }, row);
domConstruct.create("td", { innerHTML: item.owner.firstName + " " + item.owner.lastName }, row);
});
}
});
});
和HTML模板
<div class="ajax-widget">
<h1>${widgetTitle}</h1>
<div class="div1">
<table>
<thead>
<tr>
<th>Workflow ID</th>
<th>Description</th>
<th>Status</th>
<th>Due Date</th>
<th>Created By</th>
<th>Assigned To</th>
</tr>
</thead>
<tbody data-dojo-attach-point="containerNode"></tbody>
</table>
我已經使用List.js和DataTables.js的jQuery庫嘗試沒有任何成功。想要使用這些庫的原因是它們提供了我需要的功能。是否有一個dojo等價物易於實現?我都是耳朵。
我的第一個問題是這個 - 我使用最有效的方法來實現這個結果嗎?在過去的5年中,Alfresco似乎發生了很大變化,很難知道今天哪些教程/帖子仍然有用。
我已經嘗試使用dojo包添加這些庫,但是當我查看源代碼時,我看不到它們是否可用以及何時在js文件中使用「require []」關鍵字,它似乎並不德效應。
如果我要走正確的軌道,我將如何讓我的表排序和搜索。如果我吠叫錯了樹,請指出我的方向。
感謝 - 所有的建議表示歡迎:-)
如果您可以將鏈接添加到「Jeff Potts'教程」,您已經使用該鏈接將很有用。另外,請提及您所面臨的錯誤/問題。 –
我錯了。事實上這是本教程。 http://ohej.github.io/alfresco-tutorials/tutorial/aikau/tutorial.html#adding-a-menu-item-to-the-header。 – user1398017
我沒有收到任何錯誤。我所嘗試的任何一種方法都行不通(頁面上沒有新內容),或者我只是在一個庫的空白頁面上覆蓋另一個庫。一切編譯沒有錯誤。 – user1398017