JQuery dynamically generates irregular tables (front-rear end)

Tempand: There is such a table

The first four attributes are used as a combined primary key jQuery动态生成不规则表格(前后端)

Table All rows are displayed in tabs in the front end. When the ActivityId is required to be merged into one line, the ActivityCode is the same, and the ActivityVersion is also combined. Similar to this:

Second, first resolution:

First query the database of the database first, save it, save it, save it back to List

Activities The JSON object is transferred back to the page. Like this JSON.PUT (“Activities”, Activities); jQuery动态生成不规则表格(前后端)

to the JS page, then began to blind. Originally JQEURY is small white, there is no way to encounter this situation.

Third, ask the big cow: Big cattle offers two ideas: My understanding is to encounter this situation to package data into the data structure you need in the background. , It will be better in passing to the front desk.

First: Construction

Map: Map

>>

Second: Constructing List: This requires a new Java object. Shaped

<String,Map<String,List Object ActivityCode has list

This property, the object ActivityVersion has List I use The first one: first conversion data structure:

Public static map >> Listtomap (List

Activities) {Map

>> MAP = New hashMap

>> ();For (Activity Detail: Activities) {if (! map.containskey ()) {map
> mapvalue = new hashmap > (); list
 listvalue = new arraylist  (); ListValue.add (Detail); MapValue.Put (Detail.GetActivityVersion () (), listValue; map.put (detail.getActivitycode (), mapValue);} else {map <String, Map<String, List> mapValue = map.get detail .getActivityCode ()); if) {List  listValue = new ArrayList <String, Map<String, List () (mapValue.containsKey (detail.getActivityVersion ()!); listValue.add (detail); mapValue.put (detail.getActivityVersion (), ListValue;} else {list <String, Map<String, List mappvaluelist = mapValue.get (detail .getActivityVersion ()); MapValuelist.Add (Detail);MapValue.put (Detail.GetActivityVersion () (), mapvaluelist);}}} return map;} <String, List <String, List   <String, List or more, then the jQuery traverses MAP   The jQuery dynamic generated irregular table (front-rear end) is introduced to you, I hope that if you have any questions, please reply to everyone in a timely manner. Thank you very much for your support of Tumi Cloud Website!                      
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment