Closed tiegosilveira closed 6 years ago
Same Problem here, timelog_date is datetime datatype and I want to change the format.
$this->datatables->select('id,timelog_date') ->edit_column('timelog_date','$1',date("l F j, Y",strtotime('timelog_date'))) ->from('tblname');
any one has find a solution for this problem
Your syntax is wrong. The way you use the library is possible but needs some modifications which I already have done in my repo.
Currently you can try:
$this->datatables->select('id,timelog_date')
->edit_column('TestColumn', '$1 $2 $3', " helperFunction(param1, TestColumn) , id , test(123)" )
->from('tblname');
$1 => helperFunction(param1, TestColumn) $2 => id $3 => test(123)
but how can i put in the place of param an array ?
the helperfunction parms must be static i can't use $var ..?
Well this is the limit of the library. If you need that functionality, I recommend you use https://github.com/n1crack/datatables
Example http://datatables.16mb.com/sqlite_examples/edit/
Code : https://github.com/n1crack/datatables-examples/blob/master/sqlite_examples/edit/ajax.php
FYI
i have solve the problem using the json as args
display the button when the User is allowed
when if it is equal "211" displays
$this->datatables->set_database('webgpon');//banco $this->datatables->select('llids.id,llid,llids.observacoes,onus.idOLT,login,macAddress,olts.nome') ->from('llids') ->join('onus', 'llids.idONU = onus.id','left')//join ->join('olts', 'onus.idOLT = olts.id','left')//join ->edit_column('altera', '$1', $this->status('id')) ->add_column('deleta', anchor('webgpon/deleta_llid/$1',' <button class="btn btn-primary btn-xs" title="Deleta"> Deleta '), 'id'); echo $this->datatables
->generate("json");
helper class function status($id) { if($id == '211'){ $output = "<a class='btn btn-default btn-xs'
href='altera_llid'".$id."'> Altera "; }else{ $output = "" } return $output; }