How to pass the values of datatable row to spring mvc?
How to pass the values of datatable row to spring mvc?
patreeeeek
Posts: 14Questions: 7Answers: 0
$(document).ready(function () {
$('#datatables').DataTable({
"dom": '<"toolbar">frtip',
"responsive": true,
"scrollY": "550px",
"scrollCollapse": true,
"ajax": "smsSenders.json",
"aoColumns": [
{"mData": "sender"},
{"mData": "content"},
{"mData": "receiveTime"},
{"mData": "messageId","visible":false},
{"mData": "portId",
"fnCreatedCell": function (nTd) {
$(nTd).html("<i class='ti-pencil-alt btn btn-simple btn-edit btn-icon' data-target='#replyModal' data-toggle='modal' data-mode='edit'></i>\n\n\
<i class='ti-comment-alt btn btn-simple btn-reply btn-icon' data-target='#replyMod' data-toggle='modal' data-mode='reply'></i>\
");
}
}
],
language: {
"search": "_INPUT_",
searchPlaceholder: "Search records"
}
});
This is how I create my datatable.
is there any way to pass the values of the row where the button si clicked?
I am using spring mvc, orcale db running in tomcat.
This discussion has been closed.
Answers
Is this how you do it? I'm not really sure
I think you are close. Since your selector is a button and not a row
this
will be the button. You might need to change:to:
The variable
row
should end up being the row the button is on by using jQuery's closest() method. Then use therow
variable is the parameter used to get the row's data.You could use some console.log() statements to see what's going on, for example:
The syntax of this is incorrect:
The
;
should be commas:HTH,
Kevin
Hey Kevin,
Thanks for the answer.
How about if I pass it through link?
I think this part of the code is wrong
${pageContext.request.contextPath}/dashboard?sender="{"mData":"sender"};