I have below code for controller,
public function user_ajaxtest()
{
$userlistingx = $this->model_usermanage->viewuserlisting();
$userlistingy = array(
array('select' => '<input type="checkbox" name="id[]" value="">')
);
$userlisting1['data'] = array_merge($userlistingx, $userlistingy);
echo json_encode($userlisting1);
}
With this AJAX i am sending user list to DataTables. $userlistx giving me users array and i could able to see everything, But i would like to add checkbox for each row of datatable, For that i had created one more array $userlistingy, and then merge this two array,
With this, i am getting one more row instead of column in datatable,
See below ajax response which i am getting normally without merging array means, only echo json $userlistingx.
data: [{test_id: "8", user_id: "28", usernote: "1 image 1 attachment", department_id: "21",…},…] 0: {test_id: "9", user_id: "29", usernote: "1 image 1 attachment" 1: {test_id: "10", user_id: "30", usernote: "1 image 1 attachment"
But when i merget and send Json i get below,
data: [{test_id: "8", user_id: "28", usernote: "1 image 1 attachment", department_id: "21",…},…]
0: {test_id: "9", user_id: "29", usernote: "1 image 1 attachment"
1: {test_id: "10", user_id: "30", usernote: "1 image 1 attachment"
2: {select: "<input type="checkbox" name="id[]" value="">"}
In short question, How do i add select checkbox array to all my datarows?