Render on columndefs
Render on columndefs
Hallo All,
I'm Newbie , need help for this issue,
i have get and pass the data from query(store procedure), i have check the result from query, there only 27 records, but why after i pass into datatable, the record become 27 * 27 = 729 records ? (showing on the datatable is 27, but when take it the data in columndef -render , that become 729 rec?
Anyone can help me ? i just want the data is 27. Thank You
below is the code :
var tabledet = $('#tb-datatable-detail').DataTable( {
"dom":'<"row"<"col-md-2"B>>'+
'<"row"<"col-md-4"l><"col-md-8"f>>'+
'<"row"<"col-md-12"tr>>'+
'<"row"<"col-md-5"i><"col-md-7"p>>',
"paging": false,
"autoWidth": true,
"order": [[ 1, 'asc' ]],
data: datas,
scrollY:600,
scrollX: true,
columns:[
{title:'ID',data: "id", defaultContent: "",orderable:false},
{title:'GROUP MENU',data:0},
{title:'AKSES',data:1,width:550},
// {title:'kond',data:2,width:50,visible:false}
],
columnDefs: [ {
"searchable": false,
"orderable": false,
"targets": [2],
"render": function(data,type,full,meta) {
console.log(datas)
const arr = []
const newArr = data.split(',')
let obj = Object.entries(newArr)
for(let i = 0; i < newArr.length; i++) {
let localObj = {}
localObj["value"] = newArr[i]
arr.push(localObj)
}
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Replies
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin