Web Application Opener - WebSnap (4)

zhaozj2021-02-08  234

Web Application Opener - WebSnap!

Chapter 4, advancement materials library network page design

In the previous section, I discussed the design of the basic material library network page, and some Dispatcher's skills, let us first set a master-detail network page.

4-1 Master-Detail Materials Table

WEBSNAP to design this type of network page is a simple order, first please join two Table: Orders, Items, and set their master-detail information in Web DataModule. After completing, we have to join two DataSetadapters, and you can connect two tables, you can see a masterAdapter feature in the TDataSetAdapter characteristic value, which is the same as Mastersource's meaning, just the object is Adapter. After setting up, you can start the new web page, please join a Page Module to the propose, set the PageName to MasterDetailedit and Uses DataModule, and then open the Visual Page Designer to set the web page, follow the sequence to add the following components:

Then I will set up the characteristics of these components. Please select the layoutgroup1 component, you can see that she has a DisplayColumns characteristic value, the preset value is -1, this characteristic value is a controlled this layoutGroup has several columns. Simply said that LayoutGroup is a table, you can use this character value to set this table several column, please set the layoutgroup1.displaycolumns 2.

Next, we have to order the display style of layoutgroup2, please enter the following value in her Custom characteristic value, which will make the layoutgroup2 as a single box of Table:

Border = "1" bgcolor = # a5d7ef

Then we start setting the fieldGroup2 under LayoutGroup2, the characteristic value of the CommandGroup component, first is fieldGroup1, please set her Adapter feature value to ORDERS DATASETADAPTER, because we hope that the text in Group is aligned, so please also ask you Set her Custom characteristic value is align = "left".

Then add all the columns:

At the time, just set the display.components characteristic value of CommandGroup1 to FieldGroup1 and add new, delete, prev, next, apply, and refresh, the five pressing of the Master Form is set. After completing, we will start setting the Detail form, please set the graph to set the Grid1, the TableAttributes characteristic value is used to set the display of the entire GRID, Headerattributes and RowAttributes are all controlling the title and each column. I use the Custom features to order GRID1's display style. When actually works, you can choose to use CSS to be more elasticity. I hope that the user can make Detail information in this Grid, so we must use tadaptecolumn to take a pre-set TadapterDisplayColumn:

Please set TadapterEditcolumn's fieldName characteristic value to itemno, partno, qty, discount four columns, followed by adding Apply and DELETE in CommandColumn1 to New Years:

Then set the displayComponent feature of CommandGroup2 to Adaptergrid1, add a new new button in it, set her PageName to NewDetail (us next to the new information page to be set), if there is no error, you should be able to see the following This web screen:

Next, we have to add a Page Module to a special case. This page's purpose is to transfer the use of the new Detail information in this web page after pressing the new button in the Detail Form. Please set up the page name to NEWDETAIL and open the Visual Page Designer window and add the following components:

After completing the setting of the Custom features of the layoutgroup1: border = "1" This can make this layoutgroup have a single box display pattern. Then set the Adapter feature value of AdapterfieldGroup1 to order ORDERS DATASetAdapter and add two fields in ORDERNO and Custno, and set their viewmode to VMDisplay, which will make the two fields to text status and will not be affected by AdapterMode influences.

Then, set the adapter characteristic value of FieldGroup2 to Items Adapter and add Itemno, Partno, Qty, Discount, and 4 column:

The upright setcomponent characteristic value of CommandGroup1 is AdapterfieldGroup2 and adds the Apply, Cancel two press. We hope that the use of the press back to the MasterDetailedit network page after pressing the button, so please set their PageName for MasterDetaileDit: If there is no error, you will see the following website:

OK! I have finished this network page, and you can take her to see the results. Operation This page has a small place to pay attention to the ItemNo and Partno fields in Detail, Itemno and Orderno are a composite primary key. Partno must be one of the Partno Table, to handle these two fields. Difficult, just use DatasetValuelist components to solve it, I believe this is difficult to fall.

4-2, controlled transaction

We allow users to update more than Detail materials in this page, which also brought problems. When the user updated two data, if one of them failed, the other information would still save the information. In some cases, it is not allowed in some cases, so we must use the database transaction control function to solve this problem, then write the transaction control there? The best control position is in Apply Action In the BeforeExecute, we can launch transaction control in BeForeExecute, confirm if you can write a database in AfteRexecute, see the following fragment code:

procedure TwdmData.ActionApply3BeforeExecute (Sender: TObject; Params: TStrings; var Handled: Boolean); begin // transaction support Database1.StartTransaction; end; procedure TwdmData.ActionApply3AfterExecute (Sender: TObject; Params: TStrings); begin // transaction support if DSADAPTITEMS.ERRORS.ERRORCOUNT> 0 THEN DATABASE1.ROLLBACK ELSE DATABASE1.COMMIT;

By the use of the PARADOX's material library, you have to set the TDATABASE.TRANSISOLATION value to TidiRTYREAD before you use it.

This chapter

In this chapter, we learned how to use Layout to arrange components on the webpage, and use the Custom features to customize the appearance of the web page. The most important thing is that we have learned how to deal with the Master-Detail database, and the process of executing this program You will have many exceptions, the most common is probably a variant conversion error, and these errors in WebSnap are complete, so you don't have to worry.

转载请注明原文地址:https://www.9cbs.com/read-3105.html

New Post(0)