How to integrate JW player in datatable
How to integrate JW player in datatable
<
script type="text/javascript" charset="utf-8">
//To show video on the third column
function video(sData, iDataRow) {
var sReturn;
sReturn = "<div id='myElement"+iDataRow+"'>Loading the player ...</div><script type='text/javascript'>";
sReturn += "jwplayer('myElement"+iDataRow+"').setup({";
sReturn += "file: "+sData+",";
sReturn += "height: 120,";
sReturn += "image: '',";
sReturn += "width: 200";
sReturn += "})</";
sReturn += "script>";
return sReturn;
}
$(document).ready(function() {
oTable = $('#datatables').dataTable({
"aoColumnDefs": [
{'bSortable': false, 'aTargets': [0, 2, 4, 8]},{
"fnRender": function(obj) {
console.log(obj);
var sReturn = obj.aData[ obj.iDataColumn ];
sReturn = video(sReturn, obj.iDataRow);
return sReturn;
}, "aTargets": [4]}
],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": '/* Ajax url to get datas from controller */',
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"iDisplayStart ": 20,
"oLanguage": {
"sProcessing": "<img src='./img/ajax-loader_dark.gif'>"
},
"fnInitComplete": function() {
//oTable.fnAdjustColumnSizing();
},
'fnServerData': function(sSource, aoData, fnCallback)
{
//alert(aoData[0]);
$.ajax
({
'dataType': 'json',
'type': 'POST',
'url': sSource,
'data': aoData,
'success': fnCallback
});
},
});
});</script>
But videos is not showing,how to use it,.