Recently, there are friends on the Easyui and background interaction way do not understand, special do a simple arrangement, hope to be helpful to everyone!!!
In General, a functional module of the to: increase, delete, change, check four function points;
The feature-oriented page is designed as follows:
"Old" Vintage page design using: discrete design
One function for each of the three pages
1. Add a page
2. Modify the page
3. List page
"NEW" JEECG page design: The use of a page to achieve the increase, delete, change, check all the functions;
Technology Point one: JEECG page layout using Easyui layout, for the addition and modification of the page using div method, the page is dialog way pop-up;
Technology point two: form (Add/Modify) Request submission method, the use of jquery form submission;
For example, explain the JSP page structure:
Example: webroot/sun/jeecg/jeecgonedemo.jsp
You will find <body class= "Easyui-layout" > Below a number of Div, generally there will be six, below to do a detailed introduction
Part I: A detailed description of Div features
A. Query Div
Description: This is the place to append the query criteria
<divregion= "North" border= "false" title= "filter Condition" collapsed= "true" style= "Height:110px;overflow:hidden;display: none; " Align= "Left" >
... In this middle Add the query criteria field, the query field needs to correspond with the field name in the page;
<div>
B. Data list presentation div
<divregion= "Center" border= "false" >
<table id= "DataGrid" ></table>
</div>
C. Row Data button div
Note: You will find the mouse in a row of data, will show some action buttons, that is the effect of this div
<divid= "Menu" class= "Easyui-menu" style= "Width:120px;display:none;" >
D. Adding a data div
<divid= "Jeecgonedemoadddialog" style= "display:none;width:500px;height:300px;" align= "Center" >
<formid= "Jeecgonedemoaddform" method= "POST" >
.... Add the fields you want to add between the Add form
E. Modifying Data div
<divid= "Jeecgonedemoeditdialog" style= "display:none;width:500px;height:300px;" align= "Center" >
<formid= "Jeecgonedemoeditform" method= "POST" >
... In the form, add the fields you want to modify
F. Calling other page popup div
Description: The specific use of this method, you can see in the "JEECG Technical Manual".
<divid= "Iframedialog" style= "display:none;overflow:auto;width:600px;height:400px;" >
Part II: JS Code explanation-page and background interaction
1. JS Object Explanation
var searchform; Querying a Form Object
var DataGrid; Data List Objects
var jeecgonedemoadddialog;//add Page Dialog Object
var jeecgonedemoaddform; Add a Page Form object
var Cdescadd;
var Jeecgonedemoeditdialog; Modify Page Dialog Object
var jeecgonedemoeditform; Modify Page Form Object
var Cdescedit;
var Showcdescdialog;
var Iframedialog; Pop-up calls to other pages of dialog
2. Detailed Description:
Description: Add and modify the pattern is the same, only to add as an example to explain
[1].//add a div's form
Jeecgonedemoaddform = $ (' #jeecgOneDemoAddForm '). Form ({
URL: ' jeecgonedemoaction!add.action ',//corresponding to the background action method
Success:function (data) {
var json = $.parsejson (data); Action returns the processing result in JSON mode
if (JSON && json.success) {
$.messager.show ({
Title: ' Success ',
Msg:json.msg
});
Datagrid.datagrid (' reload ');
Jeecgonedemoadddialog.dialog (' close ');
} else {
$.messager.show ({
Title: ' Failure ',
Msg: ' Operation failed. '
});
}
}
});
[2].//Add Div's dialog
Jeecgonedemoadddialog =$ (' #jeecgOneDemoAddDialog '). Show (). Dialog ({
Title: ' Add a single-table model demo ',
Modal:true,
Closed:true,
Maximizable:true,
Buttons: [{
Text: ' Add ',
Handler:function () {
Jeecgonedemoaddform.submit ();//form submission
}
} ]
});
[3].//datagrid operation button corresponding method explained
Toolbar: [{
Text: ' Add ',
Iconcls: ' Icon-add ',
Handler:function () {
Add ();//The corresponding page button is added
}
}, '-', {
Text: ' Delete ',
Iconcls: ' Icon-remove ',
Handler:function () {
Del ();//corresponding to the deletion of the page button, note that the deletion here supports bulk deletion
}
}, '-', {
Text: ' Modify ',
Iconcls: ' Icon-edit ',
Handler:function () {
Edit ();//Modify the page button
}