Example of Multi Select Datatable Within a Form, passing selected values to Servlet on Submit
Example of Multi Select Datatable Within a Form, passing selected values to Servlet on Submit
ggiavelli
Posts: 5Questions: 3Answers: 0
Hi,
I have a working multi-select datatable. How can I use it in a form with a submit button, calling a java servlet with the data values from a particular column (say col 0). Do I have to get into jQuery and maintain an array of selections or should be an API call to get the data for submit. Can some one show a simple example?
This discussion has been closed.
Answers
Hi @ggiavelli ,
Are you expecting to pass the column values with Ajax? If so, use
ajax.data
to pass the values. And to get the values, userows({selected:true}).data().pluck(0)
.Cheers,
Colin
I am getting all the datatable values and some formatting info. Is there a way to clean this up on the client side so I only get the first columns values?
e.g.
$('button').click( function() {
The
pluck()
API can get column 0 usingpluck(0)
of using arrays. However if you are usingcolumns.data
then use the object property as shown in the docs.Kevin