JS do a dynamic table

  After the data is sent over the background, you need to make these data tables, table management functions to achieve the general

 

 

 For example, such a data format,

 

To create the table first

 

 Add thead tr in the table was added in the thead

 

 Loop through the array, and create the beginning of the input check box, add a check box in front of each tr Information

 

Tbody added in the table

 

 

 It can be seen traversing the value data in the data in the tbody, and is worth an additional two buttons at the end of each person, respectively, deletion and modification

Full box detection

 

 Click Add idea is;

1. Click to add a pop-up container

2. Click OK container, first create an empty object, and then obtain the input value (value) was added to the vessel, which are attached to the user input value

  

 

3. In total data appended.

data.push(empty)

4. Add a page re-rendering

 

 

 My co-deletion is all function buttons together, and then be judged by taking more than two kinds of buttons,

 

 

When an odd number is modified

 

 Delete Event

 

 Queries idea is to get the names of all the columns in the next tr tbody, because I wrote the name of the query,

After the column name appended to an empty array, the array of the current cycle, after found, create a right to accept worth array;

Loop current name worthy of that line, and then appended to the current array taken away, then the contents of the case in the table, this line alone will re-render tr

 

 

Guess you like

Origin www.cnblogs.com/hzqzwl/p/11971218.html