I want to use JQuery's Sortable (http://jqueryui.com/sortable/#connect-lists), so my left list will end with something like this
<ul>
<li>
Some txt1
<input type="hidden" name="li1" value="1"/>
</li>
<li>
Some txt2
<input type="hidden" name="li2" value="2"/>
</li>
</ul>
The number of <li>
will be different every time. My idea is to get all hidden inputs values and names put them in array and POST the array as JSON data, but how should my Controller look like?
Is there a way to "wait" for list of something in the controller. For example:
@RequestMapping(value = "/listItems")
public @ResponseBody GridModel getUsersForGrid(@RequestParam(value = "items") List<NameIdPair> items){...}
you can inject a instance of Map
holding all parameters.
@RequestMapping("/listItems")
public @ResponseBody GridModel getUsersForGrid(@RequestParam Map<String, String> params) {
params.get("parametername");
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With