I'am struggeling to make a working modal showing data from a cell of my ajax sourced datatable.
The use case:
I have a Java Spring back-end exposing webservices from a batch, and i would like to display (in this particular case) the result of on cell of my DataTable (coming from Ajax source) into a bootstrap modal.
I want this because, the data i want to put into my modal is a stacktrace error log from spring and the length is really too big.
The ui result i have for now:
I would like to display the content of the "exitMessage" from the datatable into a modal after clicking "Details" (and then be able to format the text into the modal also)
Into the code, here is what i have from now:
my .js file:
$(document).ready(function() {
('#jobStepExecutionTab').DataTable({
processing: true,
serverSide: false,
paging: true,
ajax: { url:'http://localhost:8080/stepexec', dataSrc:""},
pageLength: 30,
scrollX: true,
columns: [
{ data: "stepExecutionId" },
{ data: "version" },
{ data: "stepName" },
{ data: "jobExecutionId" },
{ data: "startTime" },
{ data: "endTime" },
{ data: "status" },
{ data: "commitCount" },
{ data: "readCount" },
{ data: "filterCount" },
{ data: "writeCount" },
{ data: "readSkipCount" },
{ data: "writeSkipCount" },
{ data: "processSkipCount" },
{ data: "rollbackCount" },
{ data: "exitCode" },
{ data: "exitMessage",
render: function(){
//let data = row.data();
return '<button class="btn btn-primary" data-toggle="modal" type="button" data-target="#myModal">Details</button>'}
},
{ data: "lastUpdated" },
],
});
}
My table .html file:
<table id="jobStepExecutionTab" class="display table table-striped table-bordered nowrap" style="width:100%">
<thead>
<tr>
<th>stepExecutionId</th>
<th>Version</th>
<th>stepName</th>
<th>jobExecutionId</th>
<th>startTime</th>
<th>endTime</th>
<th>status</th>
<th>commitCount</th>
<th>readCount</th>
<th>filterCount</th>
<th>writeCount</th>
<th>readSkipCount</th>
<th>writeSkipCount</th>
<th>processSkipCount</th>
<th>rollbackCount</th>
<th>exitCode</th>
<th>exitMessage</th>
<th>lastUpdated</th>
</tr>
</thead>
</table>