Javascript 工作流详细信息页面中的自定义表

Javascript 工作流详细信息页面中的自定义表,javascript,alfresco,freemarker,yui,alfresco-share,Javascript,Alfresco,Freemarker,Yui,Alfresco Share,除了currentTasks和workflowHistory表之外,我还想再添加两个表。我在workflow-form.get.html.ftl中添加了两个带有标题的块,在workflow-form.js中添加了两个小部件。我还在.properties文件中添加了标签映射 问题是“我的表格”始终显示在页面底部,并且没有标题: 我还注意到历史表和当前表的块也有一个ID,类似于: page_x002e_data-form_x002e_workflow-details_x0023_default-wo

除了currentTasks和workflowHistory表之外,我还想再添加两个表。我在workflow-form.get.html.ftl中添加了两个带有标题的块,在workflow-form.js中添加了两个小部件。我还在.properties文件中添加了标签映射

问题是“我的表格”始终显示在页面底部,并且没有标题:

我还注意到历史表和当前表的块也有一个ID,类似于:

page_x002e_data-form_x002e_workflow-details_x0023_default-workflowHistory-form-section
我的表没有这样的ID。它们只是放在如下容器中:

<div class="form-element-background-color yui-dt">
my workflow-form.js的一部分:

如何设置表格的位置和标题?。。例如,我想在块后面显示我的表,其中包含一般信息


可能吗?

您应该在div中插入表格,以便在顶部显示表格


希望这对您有所帮助。

另一种方法是使用YUI脚本技术:

...

/**
* Called when a workflow form has been loaded.
* Will insert the form in the Dom.
*
* @method onWorkflowFormLoaded
* @param response {Object}
*/
onWorkflowFormLoaded: function WorkflowForm_onWorkflowFormLoaded(response)
{ 
     ...
     var finishedBpDetailsContainerEl = Dom.get(this.id + "-finishedBpDetails-form-section"),
         finishedBpDetailsEl = Selector.query("div", finishedBpDetailsContainerEl, true);         

     var finishedBpDetailsDS = new YAHOO.util.DataSource(this.finishedBpDetailsData,
     {
         responseType: YAHOO.util.DataSource.TYPE_JSARRAY
     });

     var showUserThumbnail = function (elLiner, oRecord, oColumn, oData) {
        elLiner.innerHTML = '<img src="/share/res/components/images/filetypes/generic-user-32.png" title="' 
            + oRecord.getData('resolutionFio') + '" />';
     };

     YAHOO.widget.DataTable.Formatter.showUserThumbnail = showUserThumbnail;

     var finishedBpDetailsColumnDefinitions = [
        {key: "userImg", label: "", formatter: showUserThumbnail},                                                   
        { key: "resolutionPosition", label: "...", sortable: true},
        { key: "resolutionFio", label: "...", sortable: true},
        { key: "resolutionAddress", label: "...", sortable: true},
        { key: "resolutionPhone", label: "...", sortable: true},
        { key: "resolutionEmail", label: "...", formatter: 'email', sortable: true},
        { key: "resolution", label: "...", sortable: true},
        { key: "resolutionDate", label: "...", sortable: true},
        { key: "resolutionComment", label: "...", sortable: true}
     ];         

     this.widgets.finishedBpDetailsDataTable = new YAHOO.widget.DataTable(finishedBpDetailsEl, 
             finishedBpDetailsColumnDefinitions, finishedBpDetailsDS,
     {
        MSG_EMPTY: this.msg("label.noTasks")
     });

    this.widgets.finishedBpDetailsDataTable.subscribe("rowMouseoverEvent", 
        this.widgets.finishedBpDetailsDataTable.onEventHighlightRow);
    this.widgets.finishedBpDetailsDataTable.subscribe("rowMouseoutEvent", 
        this.widgets.finishedBpDetailsDataTable.onEventUnhighlightRow);

    var finishedBpAttachmentsDetailsContainerEl = Dom.get(workflowFormReference.id + "-finishedBpAttachmentsDetails-form-section"),
        finishedBpAttachmentsDetailsEl = Selector.query("div", finishedBpAttachmentsDetailsContainerEl, true);

    var finishedBpAttachmentsDetailsDS = new YAHOO.util.DataSource(this.finishedBpAttachmentsDetailsData,
    {
        responseType: YAHOO.util.DataSource.TYPE_JSARRAY
    });

    var showDocumentThumbnail = function (elLiner, oRecord, oColumn, oData) {
        elLiner.innerHTML = '<img src="/share/res/components/images/filetypes/generic-file-32.png" title="' + 
            oRecord.getData('contractFileName') + '" />';
    };

    YAHOO.widget.DataTable.Formatter.showDocumentThumbnail = showDocumentThumbnail;

    var finishedBpAttachmentsDetailsColumnDefinitions = [
         {key: "contractImg", label: "", formatter: showDocumentThumbnail},                                                             
         {key: "contractFileName", label: "...", sortable: true},
         {key: "contractNumber", label: "...", sortable: true},
         {key: "contractTitle", label: "...", sortable: true},
         {key: "contractPrescription", label: "...", sortable: true},
         {key: "contractDate", label: "...", sortable: true},
         {key: "contractContractor", label: "...", sortable: true},
         {key: "contractPurpose", label: "...", sortable: true},
         {key: "contractCoast", label: "...", sortable: true},
         {key: "contractPeriodValidity", label: "...", sortable: true},
         {key: "contractAdditionalAgreements", label: "...", sortable: true},
         {key: "contractDataStart", label: "...", sortable: true},
         {key: "contractDataEnd", label: "...", sortable: true},
         {key: "contractIssuanceMark", label: "...", sortable: true},
         {key: "contractExecution", label: "...", sortable: true},
         {key: "contractComment", label: "...", sortable: true},
         {key: "contractAdditionalNumber", label: "...", sortable: true},
         {key: "contractService", label: "...", sortable: true},
         {key: "contractView", label: "...", sortable: true}
    ];

    this.widgets.finishedBpAttachmentsDetailsDataTable = new YAHOO.widget.DataTable(finishedBpAttachmentsDetailsEl, 
        finishedBpAttachmentsDetailsColumnDefinitions, finishedBpAttachmentsDetailsDS,
    {
        MSG_EMPTY: this.msg("label.noTasks")
    });         

    this.widgets.finishedBpAttachmentsDetailsDataTable.subscribe("rowMouseoverEvent", 
        this.widgets.finishedBpAttachmentsDetailsDataTable.onEventHighlightRow);
    this.widgets.finishedBpAttachmentsDetailsDataTable.subscribe("rowMouseoutEvent", 
        this.widgets.finishedBpAttachmentsDetailsDataTable.onEventUnhighlightRow);

    YAHOO.Bubbling.fire("workflowFormReady", this);
    ...
},

... 
...

var finishedBpDetailsDS = new YAHOO.util.DataSource(dsRes,
{
    responseType: YAHOO.util.DataSource.TYPE_JSARRAY
});

var finishedBpDetailsContainerEl = Dom.get(this.id + "-finishedBpDetails-form-section"),
finishedBpDetailsTasksEl = Selector.query("div", finishedBpDetailsContainerEl, true);

var finishedBpDetailsColumnDefinitions = [
    ...
];

this.widgets.finishedBpDetailsTasksDataTable = new YAHOO.widget.DataTable(finishedBpDetailsTasksEl, 
        finishedBpDetailsColumnDefinitions, finishedBpDetailsDS,
{
    MSG_EMPTY: this.msg("label.noTasks")
});


var finishedBpAttachmentsDetailsColumnDefinitions = [
   ...
];                       

var finishedBpAttachmentsDetailsDS = new YAHOO.util.DataSource(this.dsAttachmentRes,
{
    responseType: YAHOO.util.DataSource.TYPE_JSARRAY
});

var finishedBpAttachmentsDetailsContainerEl = Dom.get(this.id + "-finishedBpAttachmentsDetails-form-section"),
finishedBpAttachmentsDetailsTasksEl = Selector.query("div", finishedBpAttachmentsDetailsContainerEl, true);

this.widgets.finishedBpAttachmentsDetailsTasksDataTable = new YAHOO.widget.DataTable(finishedBpAttachmentsDetailsTasksEl, 
        finishedBpAttachmentsDetailsColumnDefinitions, finishedBpAttachmentsDetailsDS,
{
    MSG_EMPTY: this.msg("label.noTasks")
});                     

Selector.query(".form-fields", this.id, true).appendChild(finishedBpAttachmentsDetailsTasksEl);
Selector.query(".form-fields", this.id, true).appendChild(finishedBpDetailsTasksEl);

...
<div id="${el}-summary-form-section">
            <h3>
               ${msg("header.workflowSummary")}
            </h3>...

....

...

<div class="yui-gf">
                     <div class="yui-u first avatar">
                        <img id="${el}-recentTaskOwnersAvatar" src="" alt="${msg("label.avatar")}">
                     </div>
                     <div class="yui-u">
                        <div id="${el}-recentTaskOwnersCommentLink"></div>
                        <div id="${el}-recentTaskOwnersComment" class="task-comment form-element-border"></div>
                     </div>
                  </div>
               </div>
               <div class="clear"></div>
            </div>

<!-- this is my custom table and display in the screen at the top. -->
           <div id="${el}-addl-summary-form-section" style="display:block" >
            <table>
                <tr><td>Name</td></tr>
                <tr><td>Murali</td></tr>
                </table>
        </div>
         </div>
...

/**
* Called when a workflow form has been loaded.
* Will insert the form in the Dom.
*
* @method onWorkflowFormLoaded
* @param response {Object}
*/
onWorkflowFormLoaded: function WorkflowForm_onWorkflowFormLoaded(response)
{ 
     ...
     var finishedBpDetailsContainerEl = Dom.get(this.id + "-finishedBpDetails-form-section"),
         finishedBpDetailsEl = Selector.query("div", finishedBpDetailsContainerEl, true);         

     var finishedBpDetailsDS = new YAHOO.util.DataSource(this.finishedBpDetailsData,
     {
         responseType: YAHOO.util.DataSource.TYPE_JSARRAY
     });

     var showUserThumbnail = function (elLiner, oRecord, oColumn, oData) {
        elLiner.innerHTML = '<img src="/share/res/components/images/filetypes/generic-user-32.png" title="' 
            + oRecord.getData('resolutionFio') + '" />';
     };

     YAHOO.widget.DataTable.Formatter.showUserThumbnail = showUserThumbnail;

     var finishedBpDetailsColumnDefinitions = [
        {key: "userImg", label: "", formatter: showUserThumbnail},                                                   
        { key: "resolutionPosition", label: "...", sortable: true},
        { key: "resolutionFio", label: "...", sortable: true},
        { key: "resolutionAddress", label: "...", sortable: true},
        { key: "resolutionPhone", label: "...", sortable: true},
        { key: "resolutionEmail", label: "...", formatter: 'email', sortable: true},
        { key: "resolution", label: "...", sortable: true},
        { key: "resolutionDate", label: "...", sortable: true},
        { key: "resolutionComment", label: "...", sortable: true}
     ];         

     this.widgets.finishedBpDetailsDataTable = new YAHOO.widget.DataTable(finishedBpDetailsEl, 
             finishedBpDetailsColumnDefinitions, finishedBpDetailsDS,
     {
        MSG_EMPTY: this.msg("label.noTasks")
     });

    this.widgets.finishedBpDetailsDataTable.subscribe("rowMouseoverEvent", 
        this.widgets.finishedBpDetailsDataTable.onEventHighlightRow);
    this.widgets.finishedBpDetailsDataTable.subscribe("rowMouseoutEvent", 
        this.widgets.finishedBpDetailsDataTable.onEventUnhighlightRow);

    var finishedBpAttachmentsDetailsContainerEl = Dom.get(workflowFormReference.id + "-finishedBpAttachmentsDetails-form-section"),
        finishedBpAttachmentsDetailsEl = Selector.query("div", finishedBpAttachmentsDetailsContainerEl, true);

    var finishedBpAttachmentsDetailsDS = new YAHOO.util.DataSource(this.finishedBpAttachmentsDetailsData,
    {
        responseType: YAHOO.util.DataSource.TYPE_JSARRAY
    });

    var showDocumentThumbnail = function (elLiner, oRecord, oColumn, oData) {
        elLiner.innerHTML = '<img src="/share/res/components/images/filetypes/generic-file-32.png" title="' + 
            oRecord.getData('contractFileName') + '" />';
    };

    YAHOO.widget.DataTable.Formatter.showDocumentThumbnail = showDocumentThumbnail;

    var finishedBpAttachmentsDetailsColumnDefinitions = [
         {key: "contractImg", label: "", formatter: showDocumentThumbnail},                                                             
         {key: "contractFileName", label: "...", sortable: true},
         {key: "contractNumber", label: "...", sortable: true},
         {key: "contractTitle", label: "...", sortable: true},
         {key: "contractPrescription", label: "...", sortable: true},
         {key: "contractDate", label: "...", sortable: true},
         {key: "contractContractor", label: "...", sortable: true},
         {key: "contractPurpose", label: "...", sortable: true},
         {key: "contractCoast", label: "...", sortable: true},
         {key: "contractPeriodValidity", label: "...", sortable: true},
         {key: "contractAdditionalAgreements", label: "...", sortable: true},
         {key: "contractDataStart", label: "...", sortable: true},
         {key: "contractDataEnd", label: "...", sortable: true},
         {key: "contractIssuanceMark", label: "...", sortable: true},
         {key: "contractExecution", label: "...", sortable: true},
         {key: "contractComment", label: "...", sortable: true},
         {key: "contractAdditionalNumber", label: "...", sortable: true},
         {key: "contractService", label: "...", sortable: true},
         {key: "contractView", label: "...", sortable: true}
    ];

    this.widgets.finishedBpAttachmentsDetailsDataTable = new YAHOO.widget.DataTable(finishedBpAttachmentsDetailsEl, 
        finishedBpAttachmentsDetailsColumnDefinitions, finishedBpAttachmentsDetailsDS,
    {
        MSG_EMPTY: this.msg("label.noTasks")
    });         

    this.widgets.finishedBpAttachmentsDetailsDataTable.subscribe("rowMouseoverEvent", 
        this.widgets.finishedBpAttachmentsDetailsDataTable.onEventHighlightRow);
    this.widgets.finishedBpAttachmentsDetailsDataTable.subscribe("rowMouseoutEvent", 
        this.widgets.finishedBpAttachmentsDetailsDataTable.onEventUnhighlightRow);

    YAHOO.Bubbling.fire("workflowFormReady", this);
    ...
},

...