CodeIgniter4-DataTables icon indicating copy to clipboard operation
CodeIgniter4-DataTables copied to clipboard

Use distinct() problem

Open darbor opened this issue 3 years ago • 1 comments

I have problem with use distinct()

error in file DataTableQuery.php line 101 $value = $row->{$column->alias};

"Undefined property: stdClass::$f.firmname"

temporarily fixed it yes but i don't know if it's correct

$tmp = explode('.',$column->alias);
if(count($tmp)  == 2) {
   $column->alias = $tmp[1];
}                       
$value = $row->{$column->alias};

my query to datatable is: $builder = $db->table('firms f') ->distinct() ->select('f.firmname, f.nip, f.pkd,f.id') ->where('f.deleted_at', NULL);

my query has several joins so I use "firms f"

darbor avatar Oct 14 '22 18:10 darbor

sorry late reply, temporary you can use column alias to solve this, will fix later on next update. Thanks

hermawanramadhan avatar Oct 30 '22 07:10 hermawanramadhan