hermawanramadhan / CodeIgniter4-DataTables

MIT License
92 stars 38 forks source link

Use distinct() problem #28

Open darbor opened 1 year ago

darbor commented 1 year ago

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"

hermawanramadhan commented 1 year ago

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