-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined property: stdClass::$role.id_role (select -> table.column) #6
Comments
can you show your javascript code? what php and codeigniter version do you use? |
I'm using php 8.0 and codeigniter 4.1.3 $('#table').DataTable({ |
try define your datatable option with columns like example. also if using numbering also set parameter addNumbering('number'); in your case maybe like this columns: [
{data: 'number'},
{data: 'id_role'},
{data: 'role_name'},
] |
Great, it works.. I think the error from before is come from the backend side not in the frontend side.. |
Hi, I read the documentation here about join query.
I have two simple table to join with. But there is an error says that
Undefined property: stdClass::$role.id_role
Somehow the library recognize the table name as the column name, including the period symbol.
In the documentation says that the
offices.officeCode
is fine.Here is my code :
User table structure :
id_user*
id_role**
name
Role table structure :
id_role*
role_name
Controller :
$builder = $db->table('user')
->select('name, role.id_role, role.role_name')
->join('role', 'role.id_role = user.id_role');
return DataTable::of($builder)
->addNumbering()
->toJson(true);
Error :
ErrorException
Undefined property: stdClass::$role.id_role
VENDORPATH/hermawan/codeigniter4-datatables/src/DataTableQuery.php at line 101
The text was updated successfully, but these errors were encountered: