Tag: Manager is TPS project man he img IV share picture
Eventually
There are several pits here to share.
I'm using Cloud-admin, a bootstrap CSS template.
JQuery v2.0.3 | (c) 2005, JQuery Foundation, Inc. | Jquery.org/license */jquery ui-v1.11.1-2014-08-24
The sort function of jquery is in the UI package, so the UI package is required to introduce
The beginning of the introduction of the page is not effective, create a separate page for normal use, and put the full page and normal, I do not know what the situation. It should be no problem to try again and again.
Try to think is OL label has a problem, change ul good and return ol all normal.
1 <Div>2 <olclass= "Dd-list"ID= "Checklist">3 <C:foreachItems= "${checklist}"var= "Item">4 <LiID= "${item.fieldname}">5 <spanclass= "Btn Btn-default">${item.chinesename}</span>6 </Li>7 </C:foreach>8 </ol>9 </Div>
2 candidate boxes, one is selected, the other is not selected, you can drag each other, this place uses the sortable Connectwith property
$ ("#uncheckList"). Sortable ({ connectwith: "#checkList" }). Disableselection ();
Only submit items that have been selected in that Div to the database.
Here the sortable ("ToArray") function, you need to note that out is a, (comma) separated string, content is the content of the Li attribute ID.
And it comes out in a sequence of strings. Such as.
Id= "${item.fieldname}"
But you can not directly through the Ajax post, you need to decodeuricomponent to the server side of the normal acquisition. There's nothing wrong with the rest. A very useful feature.
checklist=decodeuricomponent(checklist,true);
1<script>2 varTypeid=${param.type};3$(function() {4$ ("#checkList"). Sortable ({5Connectwith: "#uncheckList",6Delay:1,7Stopfunction(){8 varchecklist=$ ("#checkList"). Sortable ("ToArray"));9Checklist=decodeuricomponent (Checklist,true);Ten$.post ("/sequence.json", {Value:checklist,type:typeid}); One } A }). Disableselection (); - -$ ("#uncheckList"). Sortable ({ theConnectwith: "#checkList" - }). Disableselection (); - }); -</script>
1 @ResponseBody2@RequestMapping (value= "/sequence", method=requestmethod.post)3 PublicInteger updatesequence (httpservletrequest request, httpservletresponse response, Modelmap model) {4Integer classify =getclassify (request);5String value= This. GetValue (Request, "value");6 Super. Logparam (request);7String[] Attrs=stringutils.split (Value, ",");8List<customcolumn> cclist=NewArraylist<customcolumn>();9 for(intsequence=0,len=attrs.length;sequence<len;sequence++){TenCustomcolumn cc=NewCustomcolumn (); One cc.setclassify (classify); A Cc.setfieldname (attrs[sequence]); - cc.setsequence (sequence); - Cclist.add (cc); the } -Manager.savepointlistcustomcolumns (CCList, This. Getcompanyid (Request), classify); - return1; -}
Perfect.
jquery sortable submit data Save usage issues