The seventh section of Web Form designer based on ExtJS--the definition of the formula of taking number formula design

Source: Internet
Author: User

Web Form designer based on ExtJS

ExtJS-based Web Form Designer Section One

Web Form designer based on ExtJS section II--Design of form controls

ExtJS-based Web Form Designer Section three--control drag and drop

ExtJS-based Web Form Designer Section fourth--control drag and drop

The fifth section of Web Form designer based on ExtJS--Database design

The sixth section of Web Form designer based on ExtJS--Interface Framework Design

The seventh section of Web Form designer based on ExtJS--the definition of the formula of taking number formula design

ExtJS-based Web Form Designer Section eighth--design of the form engine


In this section we introduce the design of the formula for the design of the form designer. For a system, in addition to the most basic business, we may be targeted at different enterprise users or different build environment of users will dynamically add some different from the existing business types of data, which will lead to the actual production environment requires our form control to support different data source fetch number. Here I'll throw a few questions for you to think about:

    1. There are several types of single controls for a more complex form?
    2. What are the different types of control data source forms?
    3. For these different forms of data sources, can we abstract them down and use a more uniform way or method to focus on them?

After careful consideration of these issues, we find that the controls for the problem 1 form are categorized as

From the above figure we can see that the control of the form can basically be abstracted into simple type and complex type two kinds of control.

For question 2, we analyze these controls to discover the data sources of these different controls in only a few ways, as shown in two. PS: Please pay attention to the sad expression of several places, why I want to use sad expression, because these places are usually we feel the gray often not to engage in the place.

At this point 1, problem 2 has been solved, then question 3? The answer is yes. We can of course use a more abstract way to define different values for different ways of data sources.

The design of the formula of taking number we can divide the design into two parts (as shown in three), one is the definition part of the formula of the number, and the other is the analytic part of the formula of taking number. It is obvious that besides defining a set of formulas for taking numbers, it is more important to be able to parse these number formulas so that we can use them flexibly in our forms to work for us.

    • The definition of the formula for taking numbers

Before starting to explain the definition of the formula for the number of numbers, first explain several concepts, otherwise you can not understand the following figure four.

system resources : such as employee, organizational structure and other basic data, can also be the type of business involved in the system, external units and so on. In short, we can use any data in the system as a resource. These system resources are stored in the system in addition to the attribute fields that they have, they typically contain key, value values for those resources. We typically store the key for these resources in a specific business, and when the data is displayed in a specific document, the database is given the value of its corresponding value according to the key. (You can't always display a string of ID strings, who can read it.) )

Static Resources : It is generally based on the key of a resource to get all the data of that type of resource directly, for example, according to the employee type key to get all employees of the system, static resources can generally set the default value, and the range value.

Dynamic resource: A dynamic resource is actually equivalent to a static resource, which, in addition to the resource's key, may require additional parameters to obtain a specific range of that resource, such as acquiring an employee under an organizational structure that is based on another control on the form.

After we have cleared up these concepts, we formally enter the design of the number formula. We think that a well-designed take-up formula should have the following properties: The formula name, the type of control supported by the formula, the input parameters of the formula (0 or more), the formula parsing path URL, the resource type key, and the description of the formula. The type of control in which the formula name and formula is supported is a required attribute for each formula, and the other is an optional attribute (see figure III). The definition of a number of formulas for the user is better recognized, through the formula name and the description of the Formula property can be very good to know what the formula is doing, while the other several properties are good to describe the formula of the applicable control type, resource type and formula input parameters and the URL of the analytic formula.

In order to facilitate a clear description of each of the formula, we put all the number of the formula into an XML file, through the XML attributes to describe each of the formula. Here are two examples:

example one of each form will basically have a document number, and this document number is usually the system backstage according to certain rules dynamically generated, we may define here a simple " document number " of the formula is the following form:

<formula name= "Document Number" controltype= "TextField"/> it contains only two necessary property names and control types for the formula, controltype= "TextField" A control that indicates the type of TextField (text type) can choose the " document number " as the number of the formula.

example Two there are two controls on the form. One is a drop-down tree control of "department" (a), one is the drop-down tree control of "departmental employee" (b), and the data source of B is obtained dynamically from the database according to the department selected by a, so we may need to define a " the number formula for departmental employees is the following:

<formula name= "departmental employee" controltype= "Netdropdown" url= "/commonform/getdepartemployee" resourcetypeid= " Departemployee " description=" to get ">" under a Department

<Parameters>

<parameter name= "department" >departId</Parameter>

</Parameters>

</Formula>

The formula contains all the properties of the formula, where Controltype= "Netdropdown" illustrates our Netdropdown type of control (the drop-down tree type Control) can use this formula, The URL description of our formula parsing path is commonformcontroller below the Getdepartemployee method (here about MVC route Map I do not make specific explanations, I believe that the students familiar with MVC know. Do not know, please learn the knowledge of MVC. )

See here maybe some students ask, example two "department staff" have the corresponding URL to parse the formula, and example a "document number" but no URL, then how this formula is resolved? In fact, the careful classmate may notice that we define the formula of the model when the "Formula parsing path URL" is a necessary option. For this formula of the default URL path We will certainly define a unified method to parse, so that each formula in the province to define its own method of parsing. Here for the system of static resource acquisition We certainly can be unified to summarize a method to resolve their. Only a small number of special needs, we need to write their own methods to parse.

Thus, we define the basic model of the formula. The content of this section first here, the next step we need to sum up the common system of the uniform number of the formula. Then it is in our form design when the form is designed for a control property of the number of the formula set, check, save. See the next section, "ExtJS-based Web Form designer seventh--the use of the formula for taking number formula design."

The seventh section of Web Form designer based on ExtJS--the definition of the formula of taking number formula design

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.