OFBiz on the fourth quarter. The journey of my form

Source: Internet
Author: User
Tags findone

Generally use ofbiz to do backstage management, most will use ofbiz form to do backstage. Let me summarize some of the summary and questions I have when I use the form. 1. First, we look at how to use the simplest form to query a single object and display it. As follows:
< form name= "Returnheaderreason" type = "single" Default-map-name = "Returnheader" >       <actions >                   < Entity-one Value-field = "Returnheader" entity-name= "Returnheader" >                         <field-map field-name = "ReturnId" from-field= "Parameters.returnid"/>                   </entity-one >       </actions >       <field name = " Returnreason "title=" return Reason "><display ></display ></field >    </form >
You only need to use Entity-one in the Actions tab and then use the Field-map to go through the Returnid to find a record and then using Default-map-name way, to set the default mapping method ( is the name of the entity queried), field is the name of the column to be displayed. If there is a time to show all the columns can be based on
< auto-fields-entity Entity-name = ""/>< auto-fields-service service-name = ""/>
These two tags go to automatically show all the relevant columns based on the entity or service. The above is the simplest single object of the presentation, below I list a single table for you to present a list of ofbiz to provide the function of the display.
< form Name= "listreturnitem" type = "List" list-name= "Listreturnitems"                  Odd-row-style= "Alternate-row" Header-row-style = "header-row-2" Default-table-style = "basic-table Hover-bar" > <actions > <entity-and entity-name = "Returnitem" use-cache= "false" list= "ListRe                       Turnitems "> <field-map field-name =" Returnid "from-field=" Parameters.returnid "/> </entity-and > </actions > <field name = "Returnquantity" title= " Return quantity "><display ></display ></field > <field name =" Returnprice "title=" Return price "><dis Play ></display ></field > <field name = "Returntotalprice" title= "return amount" ><display >< ;/display ></field > </form > 
The same is true, here through the actions tag inside the Entity-and tag to query out the required list, the list name is Listreturnitems qualified lists to be consistent with the list-name of the form, Default-map-name can not be written here, if you write this mapping tag, when the use of row-actions, when you get a single-line property, the call will not be a single-line object, but default-map-name the object. Now, a list of single tables can be displayed. However, if you want to display the results of a multi-table federated query, what should be handled? That's what I just said. <row-actions > This tag.
< row-actions>      <script location= "component://portal/webapp/portal/web-inf/actions/returnorder/ Listreturnitem.groovy "/></row-actions >
Adding a row-actions tag to the form above represents groovy, which is called by each row. The next thing I put out is the simplest groovy. (Groovy uses the Java language similar writing style, the concrete I will continue to share with you in the future study)
if (!productid) return;product = Delegator.findone ("Product", [Productid:productid], false);p roductdescription = Product. Get ("description") context. ProductDescription = ProductDescription
the code above is to determine whether ProductID exists, if not, then return, if present, through the Delegator FindOne method to query the Product object, and then obtain the corresponding product description, the product description is assigned to the context, This allows you to add a row of columns to the form.
<field name = "ProductDescription" title= "Product description" ><display ></display ></field >
Above I give you to share is not pagination of multi-column table, if need paging function, we how to deal with, don't worry, the following for everyone to show. The first thing to know, in the ofbiz inside the use of paging, must be divided into two form, one is the above query form one is the following list form. 
 < decorator-section name = "Body" > <section > <widge ts > <decorator-screen name= "findscreendecorator" location= "component://common/                                            Widget/commonscreens.xml "> <decorator-section name=" search-options "> <include-form name= "Searchreturnorder" location= "component://portal/widget/r                                           Eturnorderforms.xml "/> </decorator-section > <decorator-section name= "Search-results" > <include-for                                        M name= "Listreturnorder" location= "Component://portal/widget/returnorderforms.xml"/>                               </decorator-section > </decorator-screen > </widgets > </section > </decorator-section > 
The above is the implementation of the pagination of the two form, I first post is to query the code of the form
< form name= "Searchreturnorder" target = "Listreturnorder" title= "" type= "single" header-row-style= "header "Default-table-style =" basic-table talbe_left_padding "> <field name =" Noconditionfind ">< hidden Valu E= "Y"/></field > <field name = "Returnid" >< text ></text ></field > <fi                Eld name = "Statusid" title= "${uilabelmap.commonstatus}" > <drop-down allow-empty = "true" > <entity-options entity-name = "Statusitem" description= "${description}" > <entity-constr            Aint name = "Statustypeid" operator= "equals" value = "Order_return_stts"/> </entity-options >             </drop-down > </field > <field name = "Createdstamp_fld0_value" title= "Request start Time" >             <date-time type = "Date"/> </field > <field name = "Createdstamp_fld0_op" > The form may involve a lot of other content, if you are beginners, you can patiently listen to my analysis of each label, if you are not a beginner, you do not have to read this article, this is my own writing to my own study advanced analysis, the purpose is to help beginners analysis and their future view. In field, you can add a label to represent the field's representation. For example, Drop-down indicates that the field entity-name the name of the object to be queried in the form of a drop-down box, description marks the field to be displayed. If you do not write
<entity-constraint name = "Statustypeid" operator= "equals" value = "Order_return_stts"/>
This tag, then the indicator will check out all the data in the table Status_item. The function of the above tag is to act as a filter, indicating that only the data of the field Statustypeid equals Order_return_stts is displayed.       
<field name = "Createdstamp_fld0_value" title= "Request start Time" >             <date-time type = "Date"/>        </field >        <field name = "Createdstamp_fld0_op" >             

  

This is a pair of tags used together, indicating that the Createdstamp field display format is the date of the form, when the query is executed, according to Greaterthanfromdaystart to query the time is greater than the start of the day. Someone might want to see how this is mapped in the/emt/framework/common/src/org/ofbiz/common/findservices.java class. It can be said that this is a mapping mechanism of ofbiz. The above is a number of commonly used tags, and then query the form to be integrated with the list, only need to specify in target Listreturnorder is the list of query control way.

OFBiz on the fourth quarter. The journey of my form

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.