-2
マイコントローラ:方法のDataTableのCIとの2パラメータを送信する
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');
$this->datatables->add_column('action',tombol_survey('$1','$2'), 'id_survey,status_survey');
$this->datatables->FROM('survey');
return print_r($this->datatables->generate('json',''));
}
そしてDataTableのための私のヘルパー:
function tombol_survey($id_survey,$status_survey)
{
$ci = & get_instance();
$html = '<span class="actions">';
If($status_survey=='terbit'){
$html .= '<a href="' . base_url() . 'subscriber/edit/' . $id_survey . '">Tutup</a>';
}elseif($status_survey=='tertunda'){
$html .= '<a href="' . base_url() . 'subscriber/edit/' . $id_survey . '">Tambah</a>';
}else{
$html .= 'Tutup | ';
}
$html .= '<a href="' . base_url() . 'subscriber/delete/' . $id_survey . '">Lihat | </a>';
$html .= '<a href="' . base_url() . 'subscriber/delete/' . $id_survey . '">Hapus</a>';
$html .= '</span>';
return $html;
}
これは、それほど含まれていないJSONないエラーが、パラメータの第二($status_survey
)があります機能if
は常にfalse
を返します。
を返す関数であれば、これはして、デバッグ今はパラメータ2($ status_survey)が含まれていましたが、まだfalseを返すならば関数 –
@MuhammadRizki:param2が設定されていればn関数はtrueを返します。関数を一度チェックしてデバッグします。 –
この機能はまだ間違っています –