Populate a list within a cell
Populate a list within a cell
toriacht
Posts: 20Questions: 5Answers: 1
Hi,
I'm trying to populate a datatable cell with an icon and a drop down list. I'm almost there! However when the list pops up it does not appear over whichever cell i clicked on , it always appears over the same cell at all times.
I populate the table as below:
Thanks,
T
[code]
$(document).ready(function(){
var oTable = $('.data-table').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": '<""l>t<"F"fpr>',
"bProcessing": true,
"sAjaxSource": "./data-subset.json",
"aoColumns": [
{"mDataProp": "date"},
{"mDataProp": "upload"},
{"mDataProp": "download"},
{
"mDataProp": "status",
"fnRender": function(oObj) {
var labelClass;
if(oObj.aData["status"] == 'Success') {
labelClass = 'success';
}
if(oObj.aData["status"] == 'In Progress') {
labelClass = 'warning';
}
if(oObj.aData["status"] == 'Fail') {
labelClass = 'important';
}
return ''+oObj.aData["status"]+'';
}
},
{
"bSearchable": false,
"bSortable": false,
"mDataProp": null,
"fnRender": function(oObj) {
return '' +
'' +
' <' +
'/a>' +
' Download';
}
}
]
});
[/code]
I'm trying to populate a datatable cell with an icon and a drop down list. I'm almost there! However when the list pops up it does not appear over whichever cell i clicked on , it always appears over the same cell at all times.
I populate the table as below:
Thanks,
T
[code]
$(document).ready(function(){
var oTable = $('.data-table').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": '<""l>t<"F"fpr>',
"bProcessing": true,
"sAjaxSource": "./data-subset.json",
"aoColumns": [
{"mDataProp": "date"},
{"mDataProp": "upload"},
{"mDataProp": "download"},
{
"mDataProp": "status",
"fnRender": function(oObj) {
var labelClass;
if(oObj.aData["status"] == 'Success') {
labelClass = 'success';
}
if(oObj.aData["status"] == 'In Progress') {
labelClass = 'warning';
}
if(oObj.aData["status"] == 'Fail') {
labelClass = 'important';
}
return ''+oObj.aData["status"]+'';
}
},
{
"bSearchable": false,
"bSortable": false,
"mDataProp": null,
"fnRender": function(oObj) {
return '' +
'' +
' <' +
'/a>' +
' Download';
}
}
]
});
[/code]
This discussion has been closed.
Replies
use aoColumnDefs and target the column in which you need the list to be shown
Ref: http://datatables.net/ref#mRender