我在git集線器上得到這個庫數據,這是點燃的數據。爲什麼函數if/else在Datatables CI中不起作用(使用Ignited)
好了,我的代碼在我的控制器,
function json_survey(){
header('Content-Type: application/json');
$this->load->library('Datatables');
$this->load->helper('datatables_helper');
$this->datatables->SELECT('id_survey,judul_survey,status_survey,responden,detail_target,judul_kategori,judul_target');
$dataids = array('id_survey'=> '$1','status_survey'=> '$2');
$this->datatables->add_column('action',tombol_survey($dataids), 'id_survey,status_survey');
$this->datatables->FROM('survey');
$this->datatables->JOIN('kategori','survey.id_kategori=kategori.id_kategori');
$this->datatables->JOIN('target','survey.id_target=target.id_target');
return print_r($this->datatables->generate('json',''));
}
,我有代碼MUY助手用函數來創建按鈕的if/else
function tombol_survey($ids)
{
$ci = & get_instance();
if(!empty($ids)){
$html = '<span class="actions">';
if($ids['status_survey']=='terbit'){
$html .= '<a href="' . base_url() . 'survey/edit/'.$ids['id_survey'].'">Tutup</a>';
}
if($ids['status_survey']=='tertunda'){
$html .= '<a href="' . base_url() . 'pertanyaan/tambah/'.$ids['id_survey'].'">Tambah</a>';
}
if($ids['status_survey']=='tutup'){
$html .= 'Hapus | ';
}
$html .= '<a href="' . base_url() . 'pertanyaan/tambah/' .$ids['id_survey']. '">Test</a>';
$html .= '</span>';
return $html;
}
}
我的問題,如果功能不工作但包含2個參數(id_survey & status_survey)。 請幫我先生
你需要調試 - $的數據ID - 用var_dump($的數據ID),並檢查它... – TimBrownlaw
什麼是$ html返回? – TimBrownlaw
html return是按鈕的返回代碼