Update the data before viewing the tables
Update the data before viewing the tables
kali83
Posts: 18Questions: 0Answers: 0
Hi,
I would need to update a negative value. For example my data is -10, i delete the "-", i color the line in red and the displayed data must be 10.
So i should update the json which returns me the php.
This is my code:
"rowCallback": function( row, data ) {
if ((data.imp < 0 && data.iuv != '') || data.st == 'D') {
$('td', row).css( 'background-color', '#ff6347' );
var val = data.imp.substr(1);
console.log(val);
}else if ((data.imp > 0 && data.iuv != '') || data.st == 'M'){
$('td', row).css( 'background-color', '#FBB917' );
}else if ((data.imp > 0 && data.iuv == '') || data.st == 'N'){
$('td', row).css( 'background-color', '#3cb371' );
}
},
How can i do?
I have read online .... but i have not found anything that was useful for me!
Thanks
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Replies
Use Orthogonal data with
columns.render
. For thedisplay
type manipulate the number to display as you like.Kevin
Thank you!
It works....
Daniel
I have another question...
This is my JSON:
"data": {"id": "548923", "coduser": 53443....}
"recordsFiltered": 175
"recordsTotal": 175
"addinfo": "LOCK"
If i wanted to display the addinfo not in the table, how can i give?
Thanks...
You can use
ajax.json()
to get the JSON response.Kevin
Thank you!
It works....