Projet

General

Profil

Project Management: adding autocomplete linked fields with project hierarchy [Solved]

Ajouté par Augusto Lucena il y a plus de 8 ans

Hi!

Enquiry 1

When customizing the advanced search fields in Share search page, is there a way to 'force' the parent field of the entitylist to be specific?

For example, I want to be able to type in all the sub-familly values from the "Food" family value, which would be just read-only.


Enquiry 2

I'm trying to use entitylist(project_hierarchy) as suggested but the control-form it's not showing the expected behavior as it does in the create new project screen from project page.

Here are my codes:

Model:

     <aspect name="ext1:aspect_dadosdocfunc">
            <properties>
                <property name="ext1:codfunc">
                    <title>Código Funcionário</title>
                    <type>d:int</type>
                    <mandatory>false</mandatory>
                    <index enabled="true">
                        <atomic>false</atomic>
                        <stored>false</stored>
                        <tokenised>TRUE</tokenised>
                    </index>
                    <constraints>
                        <constraint ref="ext1:const_codfunc"/>
                    </constraints>
                </property>
                <property name="ext1:nome_func">
                    <title>Nome Funcionário</title>
                    <type>d:noderef</type>
                    <mandatory>false</mandatory>
                    <index enabled="true">
                        <atomic>false</atomic>
                        <stored>false</stored>
                        <tokenised>TRUE</tokenised>
                    </index>
                </property>
                <property name="ext1:nome_cliente">
                    <title>Nome Cliente</title>
                    <type>d:noderef</type>
                    <mandatory>false</mandatory>
                    <index enabled="true">
                        <atomic>false</atomic>
                        <stored>false</stored>
                        <tokenised>TRUE</tokenised>
                    </index>
                </property>
            </properties>
            <associations/>
            <overrides/>
         <mandatory-aspects/>
     </aspect>

Config:
     <appearance>
          <set appearance="bordered-panel" id="dadosdocumento" label="Dados Documento" template="/org/alfresco/components/form/2-column-set.ftl"/>
          <field id="ext1:nome_cliente" label="Nome do Cliente" mandatory="false" read-only="false" set="dadosdocumento">
            <control template="/org/alfresco/components/form/controls/autocomplete.ftl">
              <control-param name="ds">becpg/autocomplete/linkedvalue/values/System/ProjectLists/bcpg:entityLists/project_Hierarchy</control-param>
            </control>
          </field>
          <field id="ext1:nome_func" label="Nome do Funcionário" mandatory="false" read-only="false" set="dadosdocumento">
            <control template="/org/alfresco/components/form/controls/autocomplete.ftl">
              <control-param name="ds">becpg/autocomplete/linkedvalue/values/System/ProjectLists/bcpg:entityLists/project_Hierarchy</control-param>
              <control-param name="parent">pjt_projectHierarchy1</control-param>
            </control>
          </field>
     </appearance>

What am I missing?? :/
----

Enquiry 3

Is there a way to use the entitylist (project_Hierarchy for example) without having to install the amps?

Thanks a lot for the assistance!


Réponses (9)

RE: Few questions - Ajouté par Augusto Lucena il y a plus de 8 ans

Any help?? PLEASE...

RE: Few questions - Ajouté par Philippe Quéré il y a plus de 8 ans

Hello,

Enquiry 1

-> not possible

Enquiry 2

Why don't you use the standard fields projectHierarchy1 and projectHierarchy2 ?
projectHierarchy1 : Nome Funcionário
projectHierarchy2 : Nome Cliente

I think you don't need a 3rd field. If you really need it, you can add a new property projectHierarchy3:

<field id="ext1:projectHierarchy3" set="mainInfo">
    <control template="/org/alfresco/components/form/controls/autocomplete.ftl">
        <control-param name="ds">becpg/autocomplete/linkedvalue/values/System/ProjectLists/bcpg:entityLists/project_Hierarchy
        </control-param>
        <control-param name="parent">pjt_projectHierarchy2
        </control-param>
    </control>
</field>

Enquiry 3

You need to install amps.

Regards,

RE: Few questions (using project hierarchy) - Ajouté par Augusto Lucena il y a plus de 8 ans

Hello!

Thanks for the answer. I put the model code just to double check that the property type had to be noderef.

Using this code, which I thought was right:

<appearance>
          <set appearance="bordered-panel" id="dadosdocumento" label="Dados Documento" template="/org/alfresco/components/form/2-column-set.ftl"/>
          <field id="ext1:nome_cliente" label="Nome do Cliente" mandatory="false" read-only="false" set="dadosdocumento">
            <control template="/org/alfresco/components/form/controls/autocomplete.ftl">
              <control-param name="ds">becpg/autocomplete/linkedvalue/values/System/ProjectLists/bcpg:entityLists/project_Hierarchy</control-param>
            </control>
          </field>
          <field id="ext1:nome_func" label="Nome do Funcionário" mandatory="false" read-only="false" set="dadosdocumento">
            <control template="/org/alfresco/components/form/controls/autocomplete.ftl">
              <control-param name="ds">becpg/autocomplete/linkedvalue/values/System/ProjectLists/bcpg:entityLists/project_Hierarchy</control-param>
              <control-param name="parent">pjt_projectHierarchy1</control-param>
            </control>
          </field>
     </appearance>

My datalist is populated this way:

It gives me the following behavior (shows the parent value):

Whereas it should show my children values (Augusto, Guli, Mozi).

Hopefully you can help me make that form control work out!

Thanks!

RE: Few questions (using project hierarchy) - Ajouté par Augusto Lucena il y a plus de 8 ans

I don't know if I made myself clear enough but I'm using standard projectHierarchy fields(according to post above).

However, it's not working for me.

That's why I'm asking for assistance.

RE: Few questions (using project hierarchy) - Ajouté par Augusto Lucena il y a plus de 8 ans

Firstly, I tried with my custom model and form using Alfresco SDK.
As it did not work, I tried to replicate the model and form config of the pjt:project type in Designer.

Population

Also, it didn't work either as the form control is showing the values from level 1 rather than the desired level 2 values:

The model and form I used are attached.

Is something else needed to get it work?? There must be something I'm missing/misleading.

Sorry for more than one post, I was trying everything in the meantime while waiting for answer to ensure I wasn't missing something.

Regards,

RE: Few questions (using project hierarchy) - Ajouté par Philippe Quéré il y a plus de 8 ans

Hello,

You are using control in the wrong way:

<appearance>
          <set appearance="bordered-panel" id="dadosdocumento" label="Dados Documento" template="/org/alfresco/components/form/2-column-set.ftl"/>
          <field id="ext1:nome_cliente" label="Nome do Cliente" mandatory="false" read-only="false" set="dadosdocumento">
            <control template="/org/alfresco/components/form/controls/autocomplete.ftl">
              <control-param name="ds">becpg/autocomplete/linkedvalue/values/System/ProjectLists/bcpg:entityLists/project_Hierarchy</control-param>
            </control>
          </field>
          <field id="ext1:nome_func" label="Nome do Funcionário" mandatory="false" read-only="false" set="dadosdocumento">
            <control template="/org/alfresco/components/form/controls/autocomplete.ftl">
              <control-param name="ds">becpg/autocomplete/linkedvalue/values/System/ProjectLists/bcpg:entityLists/project_Hierarchy</control-param>
              <control-param name="parent">pjt_projectHierarchy1</control-param>
            </control>
          </field>
     </appearance>

You must define param <control-param name="parent">pjt_projectHierarchy1</control-param> with the value of the parent field, in your case: ext1:nome_cliente.

I don't know if I made myself clear enough but I'm using standard projectHierarchy fields(according to post above).
-> you have custom fields: ext1:nome_cliente, ext1:nome_func
As you don't seem confortable with model and forms, I advice you to use beCPG with standard fields (pjt:projectHierarchy1, pjt:projectHierarchy2) without custom fields. It will avoid your break the system.
From what I see you don't need custom fields.

I hope it helps you.

Regards,
Philippe

RE: Few questions (using project hierarchy) - Ajouté par Augusto Lucena il y a plus de 8 ans

Philippe Quéré a écrit :

Hello,

You are using control in the wrong way:
[...]

You must define param <control-param name="parent">pjt_projectHierarchy1</control-param> with the value of the parent field, in your case: ext1:nome_cliente.

I don't know if I made myself clear enough but I'm using standard projectHierarchy fields(according to post above).
-> you have custom fields: ext1:nome_cliente, ext1:nome_func
As you don't seem confortable with model and forms, I advice you to use beCPG with standard fields (pjt:projectHierarchy1, pjt:projectHierarchy2) without custom fields. It will avoid your break the system.
From what I see you don't need custom fields.

I hope it helps you.

Regards,
Philippe

Finally!!!! After roughly over a week I finally managed to get it work out!

Your last post finally made things clear, I thought that the parent should be something related to the entitylist and not to the type field itself!

I knew it was something really easy, simple and basic that I was missing!

Thank you so much mon camarade!!

RE: Project Management: adding autocomplete linked fields with project hierarchy [Solved] - Ajouté par Augusto Lucena il y a plus de 8 ans

Philippe Quéré a écrit :

OK, I've updated the documentation:
https://www.becpg.fr/redmine/projects/becpg-community/wiki/Controls#autocompleteftl

I hope it's easier to understand.

Nice one, Philippe! It's much clearer now!

One las question:
I noticed that you can export the array from the entitylist for instance the hierarchyprojects that I'm using.

Is there a way to batch-input the fields of the entitylist array?

Thanks again.

    (1-9/9)