I. Methods of adding data
The code in onsubcontrolaction (self. Arg) in datapilot is:
VaR code = Arg. Code;
Switch (CODE ){
Case "+ ":
// Obtain the DataSet object of the master table
VaR datasetdept = this. Get ("# ID of the master table datasetde ");
// Obtain the dataset of the master table
VaR currentdept = datasetdept. getdata (#);
// Obtain the dataset corresponding to the reference based on the dataset of the master table.
VaR currendtemployees = currentdept. Get ("name value of reference in the main table ");
// Insert an object to the dataset Based on the obtained dataset. Note that the deptid here is not a field in the database, but an attribute of the object class.
Currentemployees. insert ({deptid: currentdept. Get ("ID ")});
// Prevent the system from automatically adding a row
Arg. processdefault = false;
Break;
}
When such code is required in a single table: (this method is generally used when the dialog box is used for modification)
VaR code = Arg. Code;
Switch (CODE ){
Case "+ ":
// Obtain the table Dataset
VaR dataset = this. Get ("# dataset ID ");
// Enter an empty record. All data is added in the dialog box.
Dataset. insert ({});
// The control system automatically adds
Arg. processdefault = false;
// Display the dialog box and submit data on the button in the dialog box
VaR dialog = this. Get ("# dialog ID ");
Dialog. Show ();
Brek;
}
The method on the cancel button is generally written as follows:
VaR dataset = this. Get ("# ID ");
// You can use the cancle function to cancel data modification since the last submission.
Dataset. getdata (). cancle ();
This. Get ("# dialog box ID"). Hide ();
Write this on the OK button, better:
VaR updateaction = this. Get ("# updateaction ");
Updateaction.exe cute (function (){
This. Get ("# dialogid"). Hide ();
});
$ {Dorado. getdataprovider ("baseclasspr # getcodes"). getresult ("clienttype ")}
$ {Dorado. getdataprovider ("baseclasspr # getcodes"). getresult ("sedsettype ")}
Ii. display of data that requires conditional Query when displaying data, including pagination
Click confirm to query the data.
// Obtain the autoform object
VaR autoform = this. Get ("# autoformid ");
// Obtain the DataSet object
VaR dataset = this. Get ("# datasetid ");
// Obtain the data filled in autoform
VaR DATA = autoform. Get ("entity ");
// Pass data as parameters
Dataset. Set ("parameter", data );
// Refresh the dataset
Dataset. flushasync ();
$ {Dorado. getdataprovider ("deptdao # getalldept"). getresult ()}
Ondatarowclick () on the node on the tree ()
VaR nodeurl = self. Get ("currentnode"). Get ("data ");
VaR mainiframe = This. ID ("mainiframe ");
Mainiframe. Set ("path", nodeurl );
// Onrwndercell () in the DataGrid ()
Arg. Dom. innerhtml = "<a href = '../issure. D? Id = "+ Arg. Data. Get ('id') +" '> "+ Arg. Data. Get ('id') +" </a> ";
//////////////////////////////////////// ////////// You can specify the value when you click Delete.
VaR updataaction = This. ID ("updateactionuserbsdn ");
Switch (CODE ){
Case "+ ":
Arg. processdefault = false;
Currentreference. insert ({corp_id: currentdatapath. Get ("ID ")});
Break;
Case "-":
Arg. processdefault = false;
Dorado. MessageBox. Confirm ("delete data? ", Function (){
Currentreference. Remove ();
Updataaction.exe cute ();
});
Break;
}
//// // Use the request in Dorado to obtain the information in the code.
VaR rerrormsg = "$ {request. getattribute ('rerrormsg ')}";