I am trying to use Flyter js to edit cells of a column in a datatable. but not sure how to add class to the datatable cell data: I need to edit ‘Label’ column.
If there is another easy way, would like to know to edit just single column of a datable and submit data to the server
Here is my html code:
<table id="tblProjectJobs" class="datatable">
<thead>
<tr>
<th>Job ID</th>
<th>Stage</th>
<th>Salary Date</th>
<th>Date</th>
<th>Label</th>
</tr>
</thead>
</table>
Javascript code with datatable and flyter code:
<script>
$(document).ready(function()
{
flyter.attach('.EditLabel',
{
type: { name: 'text' },
emptyValueDisplay: '',
renderer:
{
name: 'inline'
},
validate: function(value, instance)
{
/* Validate the edited comment is not null / zero length */
if (value == null)
{
$.notify(
{
title: 'An error occurred',
text: 'You must provide a value for your comment when editing a comment. If you wish to delete the comment, please use the Delete button.',
image: '<i class="fa fa-2x fa-check"></i>'
},
{
style: 'cosentino',
className: 'error',
position: 'bottom right'
});
return false;
}
else
{
return true;
}
}
var objTable = $("##tblProjectJobs").DataTable(
{
"columns":
[
{ data: 'JOBID'},
{ data: 'STAGEDESCRIPTION'},
{
data: 'SALARYDATE',
render: function(data, type, row)
{
if (data.length > 0)
{
return moment(data, "MMMM, DD YYYY HH:mm:ss").format("MM/DD/YYYY");
}
else
{
return "";
}
}
},
{ data: 'DATE'},
{ data: 'LABEL'},
});