How to make a master-slave form and function quickly in 10 minutes

Source: Internet
Author: User

This article describes how to use the rapid development platform to create a master-slave form page

Our website: www.sdpsoft.com

qq:136846796 Tel: 15050176512

1. Set up a data source

Create a new data source for "Test _ Reward Management _ Page":

Click the Sync field to synchronize the fields in this table ()

Create a new "test _ Reward Management _ from Table _ Page" data source

2, page design in the production page

Create a new page to configure its information

Page type Select master-slave form type

Script reference: Test.js

Add data collection (data source): Primary table information and add primary table primary key field via add field

Add from Table info: Collection Hierarchy Select Add Billcode from set associated field and Empcode Associate ancestor Field Billcode

Make a good page header to the page by copying and pasting:

Quick Build Control: Click the Quick Generate control button to build the control and refine the control information

Generated pages:

Improve the aesthetics of your page with a drag-and-pull approach

To add configuration information from the table to the page:

The JS event that defines the person number text button is used in the Test.js

To define a button in the control, click Double-clicking Event:

Save event: Punish_page_save () Delete: Punish_page_delete () Audit: Punish_page_check () Exit: Punish_page_exit ()

Add line: Punish_page_addrow () Delete line: Punish_page_delrow ()

Invoke the event in Test.js to implement the function of the button


#region Reward Management--primary single list

Reward Management--primary single list--page load
function Reward_mainlist_init () {
Func_initpagedatasource ();
}

Reward Management--main list--new events
function Reward_mainlist_add () {
Func_addnewdatabill (560, 540, "rsgl_reward_form.html", "Reward management", "reward_mainlist");
}

Reward Management--main list--edit Event
function Reward_mainlist_edit () {
Func_modifydatabill (560, 540, "rsgl_reward_form.html", "Reward management", "reward_mainlist");
}

Reward Management--primary single list--query events
function Reward_mainlist_search () {
Func_advquerybygrid ("Reward_mainlist");
}

Reward Management--main list--output event
function Reward_mainlist_export () {
Func_exportrecord ("Reward_mainlist");
}

#endregion

#region Reward Management--edit page

Reward Management--edit Page page load
function Reward_page_init () {
Func_initpagedatasource ();
if (sys_parameter.billstate = = "Edit") {
if ($id ("Txt_status"). Value! = "Draft") {
Func_lockallcontrol ();
Func_unlockonecontrol ("Btn_exit");
}
} else {
Func_lockonecontrol ("Btn_delete");
Func_lockonecontrol ("Btn_check");
}
}

Reward Management--edit page--save Event
function Reward_page_save () {
Func_savebilldata ();
}

Reward Management--edit page--delete event
function Reward_page_delete () {

if ($id ("Txt_billcode"). Value = = "") {
Alert ("The document number is empty! Delete is not allowed! ");
Return
}
Func_deletebilldata ();
}

Reward Management--edit page--Audit events
function Reward_page_check () {
if ($id ("Dt_effectdate"). Value = = "") {
Alert ("The effective date is not allowed to be empty!") ");
Return
}

if (Confirm ("Hint: Confirm approval?")) {
var _nowdatetime = Func_getnowdate ();
var _runstrsql = "Update rsgl_reward_main set status= ' has been examined, checkempcode= '" + Userinfo.usercode + "', checkempname= '" + User Info.username + "',";
Switch (userinfo.dbtype) {//database type
Case "Oracle":
_runstrsql + = "Checkdate = To_date ('" + _nowdatetime + "', ' yyyy-mm-dd HH24:mi:ss ')";
Break
Case "SQL Server":
Default
_runstrsql + = "Checkdate = '" + _nowdatetime + "'";
Break
}

_runstrsql + = "where billcode= '" + $id ("Txt_billcode"). Value + "'";

var _runparams = "<sql><! [cdata["+ encodeURI (_runstrsql) +"]]></sql> ";
var _runresxml = Runajax ("Execsql", _runparams);
if (_runresxml! = "0") {
Alert ("Audit success! ");
Location.reload (); Reload refreshes the current page
} else {
Alert ("Audit failed! ");
}
}
}

Reward Management--edit page--Exit event
function Reward_page_exit () {
Func_closedialog ();
}

Reward Management--edit page--Add line Event
function Reward_page_addrow () {
Func_addrow ("Emp_list");
}

Reward Management--edit page--delete a row of events
function Reward_page_delrow () {
Func_delrow ("Emp_list");
}

Reward Management--edit page--People selection
function Reward_page_selectemp (_rowindex, _colindex) {
Btnrowindex = _rowindex;
Btncolindex = _colindex;
Func_openpage (630, 445, "Personnel selection", "basis_empbaseinfo_baseselect.html", "Reward_page_setemp ()");
}

Reward Management--edit page--People backfill
function Reward_page_setemp (retxmlval) {
var recxmldoc = LoadXML (retxmlval);
if (!recxmldoc) return;

To edit an instance of a button event in a list
var tmnowrow = func_getrowobj ("Emp_list", Btnrowindex);
if (!tmnowrow) return;

for (var rr = 0; RR < recXmlDoc.documentElement.childNodes.length; rr++) {
var recrow = RecXmlDoc.documentElement.childNodes (RR);
for (var cc = 0; cc < recRow.childNodes.length; cc++) {
Convert to lowercase based on the bound field name to get
Switch (Recrow.childnodes[cc].nodename.tolowercase ()) {
Case "Empcode":
tmnowrow.cells[3].innerhtml = Recrow.childnodes[cc].text;
Break
Case "EmpName":
tmnowrow.cells[4].innerhtml = Recrow.childnodes[cc].text;
Break
Case "Orgcode":
tmnowrow.cells[5].innerhtml = Recrow.childnodes[cc].text;
Break
Case "OrgName":
tmnowrow.cells[6].innerhtml = Recrow.childnodes[cc].text;
Break
}
}
Break Here you get only one
}
Retxmlval = null;
Recxmldoc = null;
}


#endregion

Build in the Web:

View this page in the system:

How to make a master-slave form and function quickly in 10 minutes

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.