I have the following code
<?php
DataTables::create(array(
"name"=>"userstablelms",
"dataSource"=>$this->dataStore("manageuserslist"),
"dataSource" => function() {
return $this->src('etarab')
->query("SELECT a.id,
a.firstname,
a.lastname,
a.email,
b.data AS company,
a.country AS countryCode,
a.phone1 AS phone,
a.phone2 AS mobile
FROM mdl_user a
JOIN mdl_user_info_data b
ON a.id = b.userid
JOIN mdl_user_info_field c
ON b.fieldid = c.id and c.shortname = 'companyname'
WHERE a.deleted = 0 AND a.email NOT LIKE '%gaa.aero%' ORDER BY a.firstname ASC, a.lastname ASC")
->pipe(new CalculatedColumn(array(
"country"=>array(
"exp"=>function($data){
if ( $data['countryCode'] ) {
$file = '../scripts/codes.json';
$json = file_get_contents($file);
$json_data = json_decode($json, true);
$result = $json_data[array_search( $data['countryCode'] , array_column($json_data, 'code'))];
return $result['name'];
}
return null;
}
)
)));
},
"method"=>"post",
"serverSide"=>true,
"searchOnEnter" => true,
"responsive" => true,
"themeBase" => "bs4",
"options"=>array(
"fastRender" => true,
"searching" => true,
"ordering" => true,
"paging" => true,
"mark" => true,
"lengthMenu" => [[15, 30, 50, 100, -1], [15, 30, 50, 100, "All"]],
),
"columns"=>array(
"id"=>array(
"label" => "id",
"className" => "hidecol",
"searchable" => false,
"orderable" => false
),
"firstname"=>array(
"label" => "firstname",
),
"lastname"=>array(
"label" => "lastname",
),
"email"=>array(
"label" => "email",
),
"company"=>array(
"label" => "company",
"className" => "text-center"
),
"mobile"=>array(
"label" => "mobile",
"className" => "text-center",
),
"countryCode"=>array(
"label" => "Code",
"className" => "text-center",
"searchable" => false,
"orderable" => false,
),
"country"=>array(
"label" => "country",
"className" => "text-center",
"searchable" => false,
"orderable" => false,
),
),
"cssClass"=>array(
"table" => "table table-bordered table-striped table-sm",
"th" => "cssHeader"
),
));
?>
Jquery Script $('#userstablelms tr').dblclick(function() {
console.log ($(this));
console.log ( $(this). closest('tr'). children('td:first'). text())
var userid = $.trim($(this). closest('tr'). children('td:first'). text());
console.log(userid)
window.location = baseurl+'/profile/profile.php?action=userprofilelms&id='+userid;
});
The problem is when "serverSide"=>true the table row is not clickable, but when I make "serverSide"=>false, I am able to click the table row and it redirects me to the page I want,
My code required the "serverSide"=>true because I am fetching big amount of data. Could you help me to resolve the issue