Enter php variable data into a cell

Enter php variable data into a cell

AndreOosthuizenAndreOosthuizen Posts: 14Questions: 3Answers: 0

I have searched about every category of datatables and could not find a solution to my problem. I could also not find any alternatives on other forums and will appreciate your help please.

I need to do a large sum on a returned data field's data and then enter that returned sum into a datatable cell.

What I mean by that -
$num1 = 10; $num2 = 20; $total = $num1 + $num2; //this is where falter... $columns = array( array( 'db' => 'ID', 'dt' => 0 ), array( 'db' => 'agedays', 'dt' => 6 ), array( 'db' => 'quantity', 'dt' => 7 ), array('NOT DB BUT $total', 'dt' => 8), );

I don't want someone to write the code, just point me in the right direction please.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    Probably the easiest way would be to do that on the client with columns.render - you can render the data there any way you like. See here, it's doubling the age column and putting it into the end of the table.

    Colin

  • AndreOosthuizenAndreOosthuizen Posts: 14Questions: 3Answers: 0

    @Colin, thank you very much, I did a test and it works perfect. I did find a work around though and is now stuck with the type post method which I will ask about on another post.

    Much appreciated.

This discussion has been closed.