cancel
Showing results for 
Search instead for 
Did you mean: 

form id and datalist view

acurs
Champ in-the-making
Champ in-the-making
Hi,
     I need to extend the datalist page to be able to navigate differents views of one datalist.
     I want to display 6 views of the datalist, where they offer different arrange of properties and controls, maybe a different datatable component…
     2 views are editable where the other 4 are view only….
     I've been told that in order to do that I should declare differents form id in the forms config, so this is what I did:


<?xml version="1.0" encoding="UTF-8"?>
<alfresco-config>
   <config evaluator="model-type" condition="pmtdl:WorkplanItem">
      <forms>
         <form>
            <field-visibility>
               <show id="pmtdl:OrderID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:Description" />
               <show id="pmtdl:Teamwork" />
               <show id="pmtdl:Importance" />
               <show id="pmtdl:BaselineStartDate" />
               <show id="pmtdl:BaselineDueDate" />
               <show id="pmtdl:BaselineDuration" />
               <show id="pmtdl:Assignee" />
               <show id="pmtdl:Predecessor" />
            </field-visibility>
         </form>

         <!– –>
         <form id="datagrid_PlanificationScheduleView">
            <field-visibility>
               <show id="pmtdl:OrderID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:Description" />
               `
               <show id="pmtdl:Teamwork" />
               <show id="pmtdl:Importance" />
               <show id="pmtdl:BaselineStartDate" />
               <show id="pmtdl:BaselineDueDate" />
               <show id="pmtdl:BaselineDuration" />
               <show id="pmtdl:Assignee" />
               <show id="pmtdl:Predecessor" />
            </field-visibility>
         </form>

         <form id="datagrid_PlannificationBudgetView">
            <field-visibility>
               <show id="pmtdl:OrderID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:BudgetDescription" />
               `
               <show id="pmtdl:BaselineCost" />
               <show id="pmtdl:Category" />
               <show id="pmtdl:FixedCost" />
               <show id="pmtdl:FixedPrice" />
               <show id="pmtdl:BudgetResponsible" />
               <show id="pmtdl:BudgetApprovedBy" />
            </field-visibility>
         </form>

         <form id="datagrid_ExecutionScheduleView">
            <field-visibility>
               <show id="pmtdl:ID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Semaphore" />
               <show id="pmtdl:Status" />
               <show id="pmtdl:Importance" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:Completion" />
               <show id="pmtdl:RealStartDate" />
               <show id="pmtdl:RealDueDate" />
               <show id="pmtdl:RealDuration" />
               <show id="pmtdl:Assignee" />
               <show id="pmtdl:Deliverables" />
            </field-visibility>
         </form>

         <form id="datagrid_ExecutionBudgetView">
            <field-visibility>
               <show id="pmtdl:ID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:BudgetDescription" />
               `
               <show id="pmtdl:Category" />
               <show id="pmtdl:ActualCost" />
               <show id="pmtdl:ActualRevenue" />
               <show id="pmtdl:PercInvested" />
               <show id="pmtdl:Profitability" />
               <show id="pmtdl:BudgetApprovedBy" />
            </field-visibility>
         </form>


         <form id="datagrid_BaselineFinanceView">
            <field-visibility>
               <show id="pmtdl:ID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:BaselineCost" />
               <show id="pmtdl:BaselineCostsVariance" />
               <show id="pmtdl:ExpectedRevenue" />
               <show id="pmtdl:BaselineRevenue" />
               <show id="pmtdl:BaselineRevenueVariance" />
            </field-visibility>
         </form>

         <form id="datagrid_BaselineScheduleView">
            <field-visibility>
               <show id="pmtdl:ID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:BaselineStartDate" />
               <show id="pmtdl:BaselineStartDateVariance" />
               <show id="pmtdl:BaselineDueDate" />
               <show id="pmtdl:BaselineDueDateVariance" />
               <show id="pmtdl:BaselbaselineDuration" />
               <show id="pmtdl:BaselineDurationVariance" />
            </field-visibility>
         </form>
      </forms>
   </config>


   <config evaluator="node-type" condition="pmtdl:WorkplanItem">
      <forms>
         <form>
            <field-visibility>
               <show id="pmtdl:OrderID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:Description" />
               <show id="pmtdl:Teamwork" />
               <show id="pmtdl:Importance" />
               <show id="pmtdl:BaselineStartDate" />
               <show id="pmtdl:BaselineDueDate" />
               <show id="pmtdl:BaselineDuration" />
               <show id="pmtdl:Assignee" />
               <show id="pmtdl:Predecessor" />
            </field-visibility>
         </form>

         <!– Data Grid view –>
         <form id="datagrid_PlanificationScheduleView">
            <field-visibility>
               <show id="pmtdl:OrderID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:Description" />
               `
               <show id="pmtdl:Teamwork" />
               <show id="pmtdl:Importance" />
               <show id="pmtdl:BaselineStartDate" />
               <show id="pmtdl:BaselineDueDate" />
               <show id="pmtdl:BaselineDuration" />
               <show id="pmtdl:Assignee" />
               <show id="pmtdl:Predecessor" />
            </field-visibility>
         </form>


         <form id="datagrid_PlannificationBudgetView">
            <field-visibility>
               <show id="pmtdl:OrderID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:BudgetDescription" />
               `
               <show id="pmtdl:BaselineCost" />
               <show id="pmtdl:Category" />
               <show id="pmtdl:FixedCost" />
               <show id="pmtdl:FixedPrice" />
               <show id="pmtdl:BudgetResponsible" />
               <show id="pmtdl:BudgetApprovedBy" />
            </field-visibility>
         </form>

         <form id="datagrid_ExecutionScheduleView">
            <field-visibility>
               <show id="pmtdl:ID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Semaphore" />
               <show id="pmtdl:Status" />
               <show id="pmtdl:Importance" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:Completion" />
               <show id="pmtdl:RealStartDate" />
               <show id="pmtdl:RealDueDate" />
               <show id="pmtdl:RealDuration" />
               <show id="pmtdl:Assignee" />
               <show id="pmtdl:Deliverables" />
            </field-visibility>
         </form>

         <form id="datagrid_ExecutionBudgetView">
            <field-visibility>
               <show id="pmtdl:ID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:BudgetDescription" />
               `
               <show id="pmtdl:Category" />
               <show id="pmtdl:ActualCost" />
               <show id="pmtdl:ActualRevenue" />
               <show id="pmtdl:PercInvested" />
               <show id="pmtdl:Profitability" />
               <show id="pmtdl:BudgetApprovedBy" />
            </field-visibility>
         </form>


         <form id="datagrid_BaselineFinanceView">
            <field-visibility>
               <show id="pmtdl:ID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:BaselineCost" />
               <show id="pmtdl:BaselineCostsVariance" />
               <show id="pmtdl:ExpectedRevenue" />
               <show id="pmtdl:BaselineRevenue" />
               <show id="pmtdl:BaselineRevenueVariance" />
            </field-visibility>
         </form>

         <form id="datagrid_BaselineScheduleView">
            <field-visibility>
               <show id="pmtdl:ID" />
               <show id="pmtdl:TaskType" />
               <show id="pmtdl:Name" />
               <show id="pmtdl:BaselineStartDate" />
               <show id="pmtdl:BaselineStartDateVariance" />
               <show id="pmtdl:BaselineDueDate" />
               <show id="pmtdl:BaselineDueDateVariance" />
               <show id="pmtdl:BaselbaselineDuration" />
               <show id="pmtdl:BaselineDurationVariance" />
            </field-visibility>
         </form>
      </forms>
   </config>
</alfresco-config>


After doing that, someone told me that Share always call the default form, and I should modify the form url to call each form id…
Have anyone tried to do this, where should I modify in order to display in the datatable the differents views?
I am thinking to copy the datalist page and customized,  define a region with a list of the views, or a combo box, that when selected one the datatable should render the view with the correspondent id…

If anyone could help me or guide me a little bit I will appreciate it a lot
cheers
2 REPLIES 2

cpaul
Champ on-the-rise
Champ on-the-rise
I'm doing this via an AJAX request for the form. It sounds like you may need to do something similar from your datalist view.

As background, I updated my share-config-custom.xml in the same manner you did, by adding a new <form> element with an id attribute of "test-template-id". Then, I created a custom field control by copying the "/alfresco/site-webscripts/org/alfresco/components/form/controls/association.ftl" Freemarker template for an association field and updated it to add a "Create" button that will request the create form for the associated object to display on the page. I would like to be able to select from a variety of form configs based on the formId parameter. To do this, I pass in an ID to tell it what type of creation form to display for the associated object:


Alfresco.util.Ajax.request({
   url: Alfresco.constants.URL_SERVICECONTEXT + "components/form",
   dataObj: {
      itemKind: "type",
      itemId: "${field.endpointType}",
      formId: ${templateId}, // This is populated from a user-selected field on the form
      mode: "create",
      submitType: "json",
      showCaption: "false",
      editInline: "true",
      destination: "${form.destination?html}",
      mimeType: "text/plain",
      htmlid: "${fieldHtmlId}"
   },
   method: "GET",
   successCallback: {
      fn: function() {
         // Display returned form
      },
      scope: this
   },
   failureCallback: { … }
};

This call will format the GET request with the "formId" parameter:


http://localhost:8081/share/service/components/form?itemKind=type&itemId=p%3Asco&formId=test-templat...

I'm on Alfresco Enterprise 3.4.6 (I don't think the formId parameter was being picked up for earlier versions of Alfresco - https://issues.alfresco.com/jira/browse/ALF-4951)

This forum post also helped me: https://forums.alfresco.com/en/viewtopic.php?f=48&t=36223

acurs
Champ in-the-making
Champ in-the-making
Hi Cpaul,
       I am working with Alfresco 3.4d I didn't notice that there was a bug with the form id call, I'll upgrade to Alfresco 4 to do it.
          So besides my content model project-datalist.xml for the datalist and the share-config-custom.xml, I should create a custom data list page declaring it in web-extensions/site-data/page/projectDatalist.xml and web-extensions/site-data/template-instance/projectDatalist.xml, and in web-extensions/templates/project/projectDatalist.ftl all these files based on the default datalist page. Then I should copy the association.ftl in web-extensions/templates/customAssociation.ftl and customized to diplay the list of views associated with an object of the page (a select box) that will render a new datatable each time onselected view with the correspondent form-id.
         
        The  share/components/data-lists/datagrid.js file must not be changed, or should I add the ajaxrequest there?
      
Cheers,
Albert