Summary of the invention
The technical matters that the embodiment of the invention will solve provides a kind of method and treating apparatus that generates form, can cross operating system and the browser-cross operation, make that the method applicability of this generation form is stronger.
For solving the problems of the technologies described above, embodiment provided by the present invention is achieved through the following technical solutions:
The embodiment of the invention provides a kind of method that generates form, comprising:
Obtain the gauge outfit data and the table volume data that adopt extend markup language to describe, the gauge outfit data and the table volume data that will adopt extend markup language to describe by the Java script resolve to the HTML (Hypertext Markup Language) form;
Call and generate order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generate form according to the gauge outfit data and the table volume data of the HTML (Hypertext Markup Language) form after the described parsing;
The form that shows described generation.
Preferably, comprise the head set of definition in the gauge outfit data that the described employing extend markup language that obtains is described;
Described gauge outfit data according to the HTML (Hypertext Markup Language) form after the described parsing comprise when generating form with the table volume data: a cell of the head of described definition being gathered correspondence is merged into a cell.
Preferably, described gauge outfit data according to the HTML (Hypertext Markup Language) form after the described parsing comprise when generating form with the table volume data: nested junior unit lattice in cell, and for the junior unit lattice are provided with the DIV label.
Preferably, the different attribute information that comprises definition in the gauge outfit data that the described employing extend markup language that obtains is described;
Described gauge outfit data according to the HTML (Hypertext Markup Language) form after the described parsing comprise when generating form with the table volume data: the different attribute information that is described definition generates control.
Comprise when preferably, described gauge outfit data according to the HTML (Hypertext Markup Language) form after the described parsing generate form with the table volume data: the mapping relations of set-point beating keyboard key and operating unit lattice.
Comprise when preferably, described gauge outfit data according to the HTML (Hypertext Markup Language) form after the described parsing generate form with the table volume data: for the operating unit lattice are provided with event command, for described table volume data is provided with the ordering order.
The embodiment of the invention provides a kind for the treatment of apparatus, comprising:
Resolution unit is used to obtain the gauge outfit data and the table volume data that adopt extend markup language to describe, and the gauge outfit data and the table volume data that will adopt extend markup language to describe by the Java script resolve to the HTML (Hypertext Markup Language) form;
Generation unit is used to call and generates order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generates form according to the gauge outfit data and the table volume data of the HTML (Hypertext Markup Language) form after the described parsing;
Display unit is used to show the form of described generation.
Preferably, comprise the head set of definition in the gauge outfit data that described employing extend markup language is described;
Described generation unit comprises:
Order is provided with the unit, is used to be provided with generate order, comprises in the described generation order being provided with the indication that the corresponding cell of head set of described definition is merged into a cell;
Performance element, be used to call described generation order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generating form according to the gauge outfit data of the HTML (Hypertext Markup Language) form after the described parsing and table volume data, the corresponding cell of head set with described definition when generating form is merged into a cell.
Preferably, described generation unit comprises:
Order is provided with the unit, is used to be provided with generate order, comprises in the described generation order being provided with nested junior unit lattice in cell, and the indication of DIV label is set for the junior unit lattice;
Performance element, be used to call described generation order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generate form according to the gauge outfit data of the HTML (Hypertext Markup Language) form after the described parsing and table volume data, when generating form in cell nested junior unit lattice, for the junior unit lattice are provided with the DIV label.
Preferably, the different attribute information that comprises definition in the gauge outfit data that described employing extend markup language is described;
Described generation unit comprises:
Order is provided with the unit, is used to be provided with generate order, comprises in the described generation order that the different attribute information that promising described definition is set generates the indication of control;
Performance element, be used to call described generation order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generate form according to the gauge outfit data of the HTML (Hypertext Markup Language) form after the described parsing and table volume data, be that the different attribute information of described definition generates control when generating form.
Technique scheme as can be seen, embodiment of the invention technical scheme is to obtain gauge outfit data and the table volume data that adopts extend markup language to describe, and be gauge outfit data and table volume data to be resolved to the HTML (Hypertext Markup Language) form by the Java script, and then call and generate order and generate form according to the gauge outfit data and the table volume data that resolve to behind the HTML (Hypertext Markup Language) form, and the WEB webpage mainly is to adopt HTML (Hypertext Markup Language), the Java script also is to be embedded in the HTML (Hypertext Markup Language), therefore do not need download plug-in just can in webpage, carry out, in addition in any operating system, architecture platform, browser execution all be HTML (Hypertext Markup Language), therefore can cross operating system, platform and browser are operated, thereby applicability improves greatly.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
The embodiment of the invention provides a kind of method that generates form, can cross operating system and the browser-cross operation, make that the method applicability of this generation form is stronger.
The embodiment of the invention mainly be adopt Dynamic Hyper Text Makeup Language (DHTML, DynamicHTML)+(JS, JavaScript) technology realizes generating form to the Java script.DHTML is to create dynamic web content by waiting in conjunction with HTML, user side script (Client Side Script, for example JavaScript), cascading style sheets and document object model.JS is a kind of script (Script) language, and it is directly write code in the html document, just compiles when browser reads code, carries out.JS can support multiple browser.
Seeing also Fig. 1, is that the embodiment of the invention one generates the tableaux method process flow diagram, comprises step:
Step 101, obtain the gauge outfit data and the table volume data that adopt extend markup language to describe, will adopt the gauge outfit data that extend markup language describes and show volume data by the Java script to resolve to the HTML (Hypertext Markup Language) form;
In the embodiment of the invention, what obtain is gauge outfit data and the table volume data that adopts extend markup language to describe.Extend markup language is a kind of extendible technology, can be cited in different operating system, architecture platform and browser, and much language is all supported extend markup language is discerned and resolved, so extendability is strong.
In this step, because need in webpage, use, so obtain the gauge outfit data and the table volume data that adopt extend markup language to describe earlier, the gauge outfit data and the table volume data that will adopt extend markup language to describe by the Java script resolves to the HTML (Hypertext Markup Language) form again, and the content after the parsing just can be used as gauge outfit data and the table volume data that can edit form.
Step 102, call and generate order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generate form according to the gauge outfit data and the table volume data of the HTML (Hypertext Markup Language) form after the described parsing;
After step will adopt the gauge outfit data of extend markup language description and show volume data and resolve to the HTML (Hypertext Markup Language) form in front, this step is called and is generated order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generates form according to the gauge outfit data and the table volume data of the HTML (Hypertext Markup Language) form after the described parsing.
When the gauge outfit data according to the HTML (Hypertext Markup Language) form after the described parsing generate form with the table volume data, comprising:
When in the gauge outfit data, comprising the head set of definition, the head of described definition is gathered corresponding cell be merged into a cell.Like this, just can form the multilist header structure.
Nested junior unit lattice in cell are for the junior unit lattice are provided with the DIV label.Like this, just can be so that cell can drag, and can be that the part row, column is fixed, the part row, column can drag according to scroll bar.
When in the gauge outfit data, comprising the different attribute information of definition, be the different attribute information generation control of described definition.Like this, just can generate various different controls, comprise basic control or complicated control etc.
The mapping relations of set-point beating keyboard key and operating unit lattice.Like this, just can support the full keyboard operation, make the interface more friendly.
For the operating unit lattice are provided with event command, for described table volume data is provided with the ordering order.Like this, can more convenient user use.
The form of step 103, the described generation of demonstration.
After generating form, show the form of described generation.
From embodiment one as can be seen, the embodiment of the invention is to obtain gauge outfit data and the table volume data that adopts extend markup language to describe, and be gauge outfit data and table volume data to be resolved to the HTML (Hypertext Markup Language) form by the Java script, and then call and generate order and generate form according to the gauge outfit data and the table volume data that resolve to behind the HTML (Hypertext Markup Language) form, and the WEB webpage mainly is to adopt HTML (Hypertext Markup Language), the Java script also is to be embedded in the HTML (Hypertext Markup Language), therefore do not need download plug-in just can in webpage, carry out, in addition in any operating system, architecture platform, browser execution all be HTML (Hypertext Markup Language), therefore can cross operating system, platform and browser are operated, thereby applicability improves greatly.
Seeing also Fig. 2, is that the embodiment of the invention two generates the tableaux method process flow diagram, and embodiment two compares with embodiment one, describes embodiment of the invention technical scheme more in detail particularly.
As shown in Figure 2, comprise step:
Step 201, the gauge outfit data of obtaining the description of employing extend markup language and table volume data;
In the embodiment of the invention, gauge outfit data of obtaining and table volume data are to adopt extend markup language (XML, eXtensible Markup Language) language to describe.
The gauge outfit data mainly refer to the descriptor of every row of form.The gauge outfit data of the embodiment of the invention are to describe the definition information of each row of form by XML, comprising: whether the title of row, row are whether the control type, row of alignment direction, the row of width, the row of the title hiding, be listed as, row is read-only, the default value that is listed as etc.
The table volume data mainly refers to the specifying information content at every row, just the value of cell.Be by the corresponding grid column of gauge outfit title when the description list volume data, the title of definition tables row in the table volume data just so just can determine that this shows the column position at volume data place.The table volume data also is to adopt XML to be described.
Above-mentioned by XML describe the gauge outfit data and the table volume data, can utilize the strong characteristics of XML extendability.
Below be to adopt illustrating of gauge outfit data that XML describes:
<? xml version=" 1.0 "? 〉: show the XML form
<row set 〉
<row 〉
<title〉column</title 〉
<hide not</hide
<head set 〉
<head〉material<head 〉
</head set 〉
<width〉200</width 〉
<alignment direction〉left-justify</alignment direction 〉
<control〉text control</control 〉
<default value〉pipe tobacco</default value 〉
</row 〉
…………
<row set 〉
Below be to adopt illustrating of table volume data that XML describes:
<?xml?version="1.0"?>
<row set 〉
<OK 〉
<column〉pipe tobacco</column 〉
………………
</OK 〉
…………
<row set 〉
Step 202, the gauge outfit data and the table volume data that will adopt extend markup language to describe resolve to the HTML (Hypertext Markup Language) form;
After gauge outfit data and table volume data employing XML, gauge outfit data and the table volume data that can utilize the function among the JS will adopt XML to describe resolve to html format.
For example utilize the application programming interface function (API among the JS, Application ProgrammingInterface), the gauge outfit data and the table volume data that adopt XML to describe are resolved to html format, and the content of the html format after the parsing just can be used as gauge outfit data and the table volume data that can edit form.Need to prove, also can utilize other functions that have similar functions among the JS to resolve.
Step 203, call and generate order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generate form according to the gauge outfit data and the table volume data of the HTML (Hypertext Markup Language) form after the described parsing;
After step will adopt the gauge outfit data of XML description and show volume data and resolve to html format in front, this step is called and is generated order and obtain described gauge outfit data and the table volume data that resolves to html format, and generates form according to the gauge outfit data and the table volume data of the html format after the described parsing.
The generation order that this step is called, it can be a SET order, the function of this order is exactly to generate form according to gauge outfit data and table volume data, and different indications can be set in this order gauge outfit data and table volume data are carried out different disposal, thereby make the form edited that generates have greater functionality.
(1) generate form in the embodiment of the invention with multilist header structure:
When in the gauge outfit data, comprising the head set of definition, in order, can be provided with the indication that the corresponding cell of head set of definition is merged into a cell, when the call instruction generation can be edited form, the corresponding cell of head set of described definition will be merged into a cell so.Like this, just can form the multilist header structure.
For example, the gauge outfit of definition is " material " in the head set, if the cell of two row all is the gauge outfit as " material ", then these two cells are merged into a cell, set is as the gauge outfit of corresponding " material ", and this gauge outfit still is that cell of every row is different as the structure of gauge outfit with other just.
(2) form that the generation unit lattice can drag in the embodiment of the invention:
The form that HTML provides generally can not drag, and does not have scroll bar, and therefore when webpage represented, it was not easily that the user uses, and experiences poor yet.The embodiment of the invention can be provided with nested junior unit lattice in cell in order, the indication of DIV label is set for the junior unit lattice; Generate when can edit form in call instruction so, will be in cell nested junior unit lattice, for the junior unit lattice are provided with the DIV label.The DIV label also is the basic label of HTML, and scroll bar is arranged, therefore carry out nested by cell with the DIV label with form, just can be so that cell can drag, have rolling effect, and can be that the part row, column is fixed, the part row, column can drag according to scroll bar in addition.
Below illustrating, see also Fig. 3, is that the embodiment of the invention drags the cell synoptic diagram.
Among Fig. 3, a cell is divided into four junior unit lattice, just nested four junior unit lattice A, B, C, D in cell.Vertical, the horizontal scroll bar of A, B, C cell are fixed, and when the D cell is operated, when for example the D cell is vertically dragged scroll bar, the C cell detects moving of D cell, to follow vertical rolling simultaneously, like this, D, C cell are rolling, A, B cell then maintain static, and promptly the row of A, B correspondence is motionless; When the D cell was laterally dragged scroll bar, the B cell will be followed horizontal rolling simultaneously, and like this, D, B cell are rolling, and A, C cell then maintain static, and promptly the row of A, C correspondence are motionless.
(3) generate form in the embodiment of the invention with multiple control:
When in the gauge outfit data, comprising the multiple different attribute information of definition, the different attribute information that promising described definition can be set in order generates the indication of control, when the call instruction generation can be edited form, will be that the different attribute information of described definition generates control so.Like this, just can generate various different controls, comprise basic control or complicated control etc.
The control that existing HTML provided generally has only basic control, for example edit box, radio box, multiselect frame, combobox etc.The embodiment of the invention can be on the basis of the original control of HTML, and according to the multiple different attribute information that defines in the gauge outfit data, packing generates text box, integer frame, the number frame that floats, different controls such as Dan Xuan/multiselect frame, date control and prompting control.
Said text box can be imported literal, numerical value, Chinese character; The integer frame, only with input digit, and initial can not be 0; The floating number frame, only with input value, radix point, and initial can not be 0; Dan Xuan/multiselect frame provides Dan Xuan and multiselect to choose mode for two kinds; Combobox provides a plurality of candidate values; The date control provides multiple date input modes such as date of entry, time on date, year, days; The prompting control provides and ejects the expansion that dialog box is selected.
Therefore, the control type that the embodiment of the invention provides is more abundant, thereby more convenient user uses.
(4) generate the form of supporting the full keyboard operation in the embodiment of the invention:
Can set-point beating keyboard key in order and the mapping relations of operating unit lattice, so when the call instruction generation can be edited form, the contingent various operations of cell institute in the form that is generated just produce mapping relations with keyboard key, for example the enter key correspondence is represented the next unit lattice, and cell selection operation etc. is carried out in the corresponding expression of key up and down.Like this, just can support the full keyboard operation, be user-friendly to, make the interface more friendly.
(5) generate the form of supporting event response and ranking function in the embodiment of the invention:
Event command that can each cell of setting operation in order, so when the call instruction generation can be edited form, cell in the form that is generated just produces corresponding relation with incident, and cell is clicked or during double click operation, will be triggered events corresponding follow-up like this.
Incident mainly comprises click event, double-click incident, value change events, and is as follows:
Setting for click event:
Table.onContentRowClick=function(i,j){
…………
}/* describes: click event.
* parameter: i: click row-coordinate; J: click the row coordinate
*/
Foregoing is illustrated in click when can edit form, responds this incident, and can obtain clicking the row-coordinate of form in the event response process, the row coordinate.
Setting for the incident of double-click:
Table.onContentRowDblClick=function(i,j){
…………
}/* describes: the double-click incident.
* parameter: i: click row-coordinate; J: click the row coordinate
*/
Foregoing is illustrated in and hits when can edit form, responds this incident, and can obtain clicking the row-coordinate of form in the event response process, the row coordinate.
Setting for the value change events:
Table.onChange=function(i,j){
………
}/* describes: the value change events.
* parameter: i: click row-coordinate; J: click the row coordinate
*/
Foregoing is illustrated in editor's form during data, and changing as data value then responds this incident, and can obtain clicking the row-coordinate of form, row coordinate in the event response process.
In addition, can also be in order for the table volume data is provided with the ordering order, for example logarithm value size ordering according to value, character string then according to the character boundary ordering, sort according to the date sequencing by the date.Like this, can more convenient user use.
The form ofstep 204, the described generation of demonstration.
After generating form, the form of described generation is shown to the user, the user can carry out editable operation to the form of this generation.
From embodiment two as can be seen, the embodiment of the invention is to obtain gauge outfit data and the table volume data that adopts extend markup language to describe, and be gauge outfit data and table volume data to be resolved to the HTML (Hypertext Markup Language) form by the Java script, and then call and generate order and generate form and show according to resolving to gauge outfit data behind the HTML (Hypertext Markup Language) form and table volume data, and the WEB webpage mainly is to adopt HTML (Hypertext Markup Language), the Java script also is to be embedded in the HTML (Hypertext Markup Language), therefore do not need download plug-in just can in webpage, carry out, in addition in any operating system, architecture platform, browser execution all be HTML (Hypertext Markup Language), therefore can cross operating system, platform and browser are operated, thereby applicability improves greatly.
In addition, the technical scheme among the embodiment two can also provide multilist greatest service energy, supporter lattice drag function and support the full keyboard operation, can generate multiple control or the like in addition, and is therefore more user-friendly.
Foregoing describes the method that the embodiment of the invention generates form in detail, and corresponding, the embodiment of the invention provides a kind for the treatment of apparatus.
Seeing also Fig. 4, is embodiment of the invention treating apparatus structural representation.
As shown in Figure 4, treating apparatus comprises:resolution unit 401,generation unit 402,display unit 403.
Resolution unit 401 is used to obtain the gauge outfit data and the table volume data that adopt extend markup language to describe, and the gauge outfit data and the table volume data that will adopt extend markup language to describe by the Java script resolve to the HTML (Hypertext Markup Language) form;
Generation unit 402 is used to call and generates order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generates form according to the gauge outfit data and the table volume data of the HTML (Hypertext Markup Language) form after the described parsing;
Display unit 403 is used to show the form of described generation.
This treating apparatus has different embodiments:
Embodiment one:
Comprise the head set of definition in the gauge outfit data that described employing extend markup language is described; Describedgeneration unit 402 can be to comprise:
Order is provided withunit 4021, is used to be provided with generate order, comprises in the described generation order being provided with the indication that the corresponding cell of head set of described definition is merged into a cell;
Performance element 4022, be used to call described generation order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generating form according to the gauge outfit data of the HTML (Hypertext Markup Language) form after the described parsing and table volume data, the corresponding cell of head set with described definition when generating form is merged into a cell.
Embodiment two:
Describedgeneration unit 402 can be to comprise:
Order is provided withunit 4021, is used to be provided with generate order, comprises in the described generation order being provided with nested junior unit lattice in cell, and the indication of DIV label is set for the junior unit lattice;
Performance element 4022, be used to call described generation order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generate form according to the gauge outfit data of the HTML (Hypertext Markup Language) form after the described parsing and table volume data, when generating form in cell nested junior unit lattice, for the junior unit lattice are provided with the DIV label.
Embodiment three:
The different attribute information that comprises definition in the gauge outfit data that described employing extend markup language is described;
Describedgeneration unit 402 comprises:
Order is provided withunit 4021, is used to be provided with generate order, comprises in the described generation order that the different attribute information that promising described definition is set generates the indication of control;
Performance element 4022, be used to call described generation order and obtain described gauge outfit data and the table volume data that resolves to the HTML (Hypertext Markup Language) form, and generate form according to the gauge outfit data of the HTML (Hypertext Markup Language) form after the described parsing and table volume data, be that the different attribute information of described definition generates control when generating form.
In addition, the mapping relations of all right set-point beating keyboard key and operating unit lattice in order, when the call instruction generation can be edited form, the contingent various operations of cell institute in the form that is generated just produced mapping relations with keyboard key so.
The event command of all right each cell of setting operation in order, so when the call instruction generation can be edited form, cell in the form that is generated just produces corresponding relation with incident, and cell is clicked or during double click operation, will be triggered events corresponding follow-up like this.
Can also be in order for the table volume data is provided with the ordering order, for example logarithm value size ordering according to value, character string then according to the character boundary ordering, sort according to the date sequencing by the date.
In sum, the embodiment of the invention is to obtain gauge outfit data and the table volume data that adopts extend markup language to describe, and be gauge outfit data and table volume data to be resolved to the HTML (Hypertext Markup Language) form by the Java script, and then call and generate order and generate form according to the gauge outfit data and the table volume data that resolve to behind the HTML (Hypertext Markup Language) form, and the WEB webpage mainly is to adopt HTML (Hypertext Markup Language), the Java script also is to be embedded in the HTML (Hypertext Markup Language), therefore do not need download plug-in just can in webpage, carry out, in addition in any operating system, architecture platform, browser execution all be HTML (Hypertext Markup Language), therefore can cross operating system, platform and browser are operated, thereby applicability improves greatly.
More than a kind of method and treating apparatus that generates form that the embodiment of the invention provided is described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.