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--main single list--page load function reward_mainlist_init () {Func_initpagedatasource ();}//Reward Management--main list--add Event 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--main single list--query event function Reward_mainlist_search () {Func_advquerybygrid ("reward_mainlist");}//Reward Management--main single 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 ("document number is empty! Delete is not allowed! ");return; } func_deletebilldata (); } //Reward Management--edit page--Audit event function Reward_page_check () {if ($id ("Dt_effectdate"). Value = = "") {alert ("The effective date is not allowed to be empty!         ");     Return }     if(Confirm ("tip: Do you want to confirm the audit?")) {var_nowdatetime = Func_getnowdate ();var_runstrsql ="Update Rsgl_reward_main set status= ' has been examined ', checkempcode= '"+ Userinfo.usercode +"', checkempname= '"+ Userinfo.username +"',";Switch(Userinfo.dbtype) {//database type Case "Oracle": _runstrsql + = "Checkdate = To_date ('" + _nowdatetime + "', ' yyyy-mm-d                 D 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 Refresh 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 event function Reward_page_delrow () {Func_delrow ("emp_list");}//Reward Management--edit page--People choose 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--Staff 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(varRR =0; RR < recXmlDoc.documentElement.childNodes.length; rr++) {varRecrow = RecXmlDoc.documentElement.childNodes (RR); for(varCC =0; CC < recRow.childNodes.length; cc++) {//Get Switch (recrow.childnodes[cc].nodename.tolowercase ()) {case "Empcode" according to the bound field name converted to lowercase:                     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; //only one} Retxmlval = null is obtained here; Recxmldoc = null; }

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.