Search code examples
xmlformsfieldofbiz

Listing ofbiz entity in a form


I am learning Ofbiz and I find it quiet hard as it's not well documented and there are not a lot of tutorials about it. I'm trying to display information from an entity but only the list titles are showing and the no information is displayed.

    <form name="ListProfile" type="list" list-name="listIt"
        paginate-target="FeedScreen" default-entity-name=""
        separate-columns="true" odd-row-style="alternate-row"
        header-row-style="header-row-2"
        default-table-style="basic-table 
        hover-bar">
    <actions>
       <service service-name="performFind" result-map="result" result-map-list="listIt">
           <field-map field-name="inputFields" from-field="parameters"/>
           <field-map field-name="entityName" value="Person"/>
           <field-map field-name="orderBy" from-field="parameters.sortField"/>
           <field-map field-name="viewIndex" from-field="viewIndex"/>
           <field-map field-name="viewSize" from-field="viewSize"/>
        </service>
    </actions>
    <field name="userLoginId" title="userLogin"><display-entity entity-name="UserLogin"/></field>
    <field name="partyId" title="partyId"><display/></field>
    <field name="lastName" title="lastName" sort-field="true"><display/></field>
    <field name="birthDate" title="birthDate" sort-field="true"><display/></field> 
   
</form>

I'm wondering also what does the word 'parameters' refer to.


Solution

  • I think your screen has some issue for not getting partyId, lastName and birthDate. You can edit your code as mine. Change location to your form location inside include-form tag.

         <screen name="ListProfile">
           <section>
            <actions>
                <set field="headerItem" value="ListProfile"/>
                <set field="entityName" value="Person"/>
                <set field="parameters" from-field="parameters"/>
                <entity-and list="list" entity-name="Person" />
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" 
                    location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="Profile List">
                            <section>
                                <widgets>
                                     <include-form name="ListProfile" location="component://humanres/widget/dataimport/DataImportForms.xml"/>
                                </widgets>
                            </section>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    

    Now Edit Your Form as mine to get User Login Id from UserLogin Entity and other information from Person Entity

        <form name="ListProfile" type="list" list-name="list"
        odd-row-style="alternate-row" header-row-style="header-row-2"
        default-table-style="basic-table hover-bar" >
        <actions>
            
            <service service-name="performFind" result-map="result" result-map-list="list">
                <field-map field-name="inputFields" from-field="parameters"/>
                <field-map field-name="entityName" value="Person"/>
                <field-map field-name="orderBy" from-field="parameters.sortField"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
            </service>
        </actions>
        <row-actions>
            <entity-and entity-name="UserLogin" list="userLogin">
                <field-map field-name="partyId" from-field="partyId"/>
            </entity-and> 
        </row-actions>
        <field name="userLoginId" title="userLogin"><display description="${userLogin[0].userLoginId}"/></field>
        <field name="partyId" title="partyId"><display/></field>
        <field name="lastName" title="lastName" sort-field="true"><display/></field>
        <field name="birthDate" title="birthDate" sort-field="true"><display/></field> 
    </form>
    

    Output Result of mine:

    Output