DWZ .....

Source: Internet
Author: User
Tags call back
Top J-hi Lookup for cascading drop effects

Description : The processing mechanism of lookup in the DWZ version is completely different from that of the classic, there are two manifestations of lookup, one is to bring back the selected value by clicking the Lookup Icon Pop-up dialog box, The other is by entering the appropriate information in the text box to achieve an online lookup with the back effect. For the purposes of implementation, it is simply that the primary key value of the entity of lookup is brought back to one element of hidden, while the other values are only used as a display reference, regardless of the underlying database structure and the database table. A complete lookup consists of the following HTML elements: 1 A hidden is used to save the ID value that is returned to the entity's primary key; If you want to implement the default lookup filtering or sorting the corresponding PageInfo hidden element, use the specific implementation method see the HOWTO manual (2) N text to display multiple data return items brought back (note: Because the data items that are returned have nothing to do with the data access layer, which is the database table, the name of each text has a hi_ as the prefix); 3) A lookup has and only one master takes back the item, Only the text box for the master-back item is editable and only the master-returned item has a lookup icon, which is a element in HTML.

Extended Property name

Description

Lookupgroup

The lookup group can be understood as the name of the current entity, and if the current lookup component is in the primary entity, then Lookupgroup is the entity name, if the current lookup component is in the entity (that is, lookup in the schedule) Then Lookupgroup is the collection property name of the detail

Lookupname

The lookup name can be understood as the property name of the current lookup entity. From the overall DWZ framework to analyze, in fact all the tab in an IE window, that is, JS file in the Open browser will only load once. This creates the uniqueness of each HTML element that must be guaranteed, even under different tabs. For lookup, it is through lookupgroup+lookupname to determine the uniqueness of the element.

Suggestclass

The main return item will have this attribute to implement associative lookup to bring back

Fully qualified name of the Pojo class for the lookup entity

Searchfields

The list of property names filtered by the query, separated by commas. For example, bring back Hiuser, the value of this property is "Fullname,usernum", in the text box 001 platform will query the name or is numbered 001 of all users

Callback

The callback method name that is used to find the method that the system will call back the value of the property after the value has been returned to implement the special handling you have with the back. For example Callback=fun, the system automatically invokes the fun method after the value is returned and automatically passes in two parameter fun (Json,index), where JSON: is the full JSON object that is brought back, index: is the indexed value, Mainly used for details of the bring back when to provide the first few detail records

Scene Description : A member Edit page to specify the member's province, city, region, the province will be selected after the selection of provinces automatically filtered cities, regions and so on.

All of the following steps simply modify the organizationedit.jsp file to

Step one , for the province's main belt back item plus callback callback method, and in the implementation of the JS method

<input type= "text" class= "TextInput" name= "Organization.hi_province.name" value= "${organization.province.name}" callback= "Processprovince"

function processprovince (JSON) {

document.getElementById ("pageInfo.province.f_id"). Value = Json.id;

The purpose of the method is to place the ID value of the province in the specified hidden element after a province is selected

Step Two , add a hidden element for the city to filter, note: The assignment statement in the Processprovince () method is the hidden element; the name used for filtering must correspond to the specific class of PageInfo ; You must specify Lookupgroup and Lookupname

<input type= "hidden" lookupgroup= "organization" lookupname= "Name=" pageInfo.province.f_id "id=" pageInfo.province.f_id "value=" "/>

The third step is to add the callback callback method for the main belt back of the city, and implement the JS method

<input type= "text" class= "TextInput" name= "Organization.hi_city.name" value= "${organization.city.name}" callback = "Processcity"

function processcity (JSON) {

document.getElementById ("pageInfo.city.f_id"). Value = Json.id;

}

Step four , add a hidden element for the region to filter

<input type= "hidden" name= "pageInfo.city.f_id" id= "pageInfo.city.f_id" lookupgroup= "organization" Region "Value=" "/>

Summary : Cascade dropdown is actually a variant of lookup, the main idea is to add a filter to the Drop-down lookup that you want to cascade, such as a filter item in a city plus a province, where the value of the filter is saved to the filter by a callback method when the province is selected. In this way the Cascade filter realizes the cascading pull effect.  /files/hao-zhang-hi/organizationedit.rar posted @ 2011-06-03 17:53 Zhang Hao Reading (991) |  Comments (4) | Edit Favorites
Top J-hi Entity and Database Table Association relationship

You can simply interpret the J-hi modeling tool as an E-R diagram of the database, each entity corresponds to a database table, and each attribute in the entity corresponds to a field in the database table. So how does the relationship between entities and entities, or the relationship between tables and tables, be described?

The relationship between database tables can be divided into the following several forms

Many-to-one: the equivalent of a database table field (foreign key) corresponding to another database table of the primary key, for J-hi, is a lookup (lookup brought back). That is, a property in an entity is a lookup type, and this property will lookup another entity. See "Application Development Video" for the steps defined for lookup. The display in the page, such as you have an expense statement, to lookup the user, then the platform will automatically bring the user's name back, and in the database to save the user ID value to the corresponding field in the reimbursement sheet.

One-to-many: the equivalent of a database table will have one or more details, such as a claim sheet and the expense statement detail is a schedule. The implementation in the database side is in the form of a foreign Key ID field for the primary table in the BOM. In J-hi we call it reference, see online Help for specific operations

one-to-one: the so-called one-to-one relationship in the database of the understanding that, B table each plus a record a table will be added with a record, in the J-hi in the form of entity inheritance

For entity inheritance, not just simple table one-to-one relationships, entity inheritance also includes all Java class inheritance relationships, JSP page integration, etc.

Many-to-many: many-to-many is a complex table relationship, J-hi through intermediate transition tables to achieve this many-to-many relationship, for example, a project can have more than one member, and a member may be in multiple projects, modeling the diagram is

Posted @ 2011-05-31 10:34 Zhang Hao Reading (363) |  Comments (0) | Edit Favorites
Top Example of J-HI output JSON data to foreground

1. Front Page:

Customizing a callback function Ajaxdone

<form action= "expert_baseinformationsave.action?navtabid=expert_baseinformationlist&callbacktype= Closecurrent&ajax=1 "

Method= "POST" class= "Pageform required-validate" onsubmit= "return Validatecallback (this, ajaxdone)" >

callback function

<script type= "Text/javascript" >

function Ajaxdone (JSON)

{

alert (json.expert.name);

}

</script>

2. Background code:

public class Expert_baseinformationsaveaction extends Baseaction implements synchronizationdata{

Private Expert_baseinformation expert_baseinformation;

private jsonobject json;

Public String Execute () throws Exception {

Expert_baseinformationmanager expert_baseinformationmgr = (Expert_baseinformationmanager)

Springcontextholder.getbean (Expert_baseinformation.class);

if (Super.perexecute (expert_baseinformation)!= null) return Returncommand ();

Expert_baseinformationmgr.saveexpert_baseinformation (expert_baseinformation);

Super.postexecute (expert_baseinformation);

json = new Jsonobject ("Expert", Expert_baseinformation, "name, gender, Unit");

             

Return "JSON";

}

Public Expert_baseinformation getexpert_baseinformation () {

return expert_baseinformation;

}

public void Setexpert_baseinformation (Expert_baseinformation expert_baseinformation) {

This.expert_baseinformation = expert_baseinformation;

}

Public Jsonobject Getjson () {

return JSON;

       }     

}

Note: The public jsonobject Getjson () must be defined in the action () {

return JSON;

Otherwise the foreground cannot get the JSON data.



Note: This document by J-hi enthusiasts "stupid" to provide, his QQ number is 289542213, welcome everyone with him in a lot of technical exchanges
Posted @ 2011-05-29 22:21 Zhang Hao Reading (359) |  Comments (0) | Edit Favorites
[Top]j-hi Platform Tree Two (node filter implementation)

This paper mainly explains the filtration of tree in J-hi. Take the Employee department tree as an example.

Requires that when you click on an employee, you can view the department where the employee is located.

Figure 1-Department tree

Figure 2 Below is a list of all employees:

Figure-2

When you click Harry, show the department structure Tree where Harry is located as shown in Figure 3.

Figure-3

Main code section:

1, the JSP hyperlink code:

<a

href= "Tree.action?menuname=orglist&orgid=${item.org.id}" target= "dialog" >${item.org.orgName}</a>

Note: OrgID is a dynamically passed in parameter, which refers to the department number where the employee is located.

2, in the himenu-config.xml of the configuration of the department tree after the addition of such a paragraph

<void property= "Filter" >

<string>org.cis.filter.orgCollectionProcessor</string>

</void>

Note: Within the string label is the class that writes the filtered data. Filtering the data of the tree, providing two kinds of interface methods to filter the data menufilterprocessor to fill in the filter before obtaining the data; Menucollectionprocessor the data after the data is collected. The specific way to view the Java-doc API.

And the example of the Orgcollectionprocessor class code:

Public class Orgcollectionprocessor implements menucollectionprocessor {

Public Collection GetCollection (Collection coll, map<string, string> Map) {

TODO auto-generated Method stub

Coll-data collection for the next level node of the current node

Map dynamic incoming data, in the form of a map

Pass in the Department ID where an employee is located, and return the department structure tree where the employee is located

int orgid=integer.parseint (map.get ("OrgID"). toString ());

for (Iterator iterator = Coll.iterator (); Iterator.hasnext ();) {

Object obj = (object) iterator.next ();

if (obj instanceof hiorg) {

hiorg hiorg = (hiorg) obj;

if (Hiorg.getid ()!=orgid) {

Iterator.remove ();

Coll.remove (obj);

}

}

}

return Coll;

}

}


Note: This document by J-hi enthusiasts "no" to provide, his QQ number is 924372739, welcome everyone with him in a lot of technical exchanges
Posted @ 2011-05-19 22:04 Zhang Hao Reading (284) |  Comments (0) | Edit Favorites
[One of the top]j-hi platform trees (implemented with back)

The Tree menu is a good representation of the dependencies before the menu item, and the structure is clear. The J-hi platform provides custom tree-shaped menus that can be implemented with a simple configuration.

This paper mainly introduces the realization method of choosing the node value with the tree menu. Take the choice to bring back the administrative division position for example. database table Design:

default bring back to Page selection interface:

By Jhi the function of automatic generation of code, the field of lookup xzqhwz is the default to bring back to the page, obviously can not represent the principal-subordinate relationship between administrative divisions. Tree with Back page:

And if the following page to achieve the display, will be clear and convenient many.

Double-click to bring back the node, or you can configure it back to the node's various parent nodes.

Here's how to configure: Configure methods: Modify XML

Modify C: "program" Hi-studio "Eclipse" Workspace "Earch5" web "web-inf" config "himenu-config.xml

At the end of the code:

</object>

</java>

Insert before: (note modify parameters therein)

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.