If u want sort it by alphabet, but the data in database is id. So when u click the sort button. it will sort by id desc or asc.
How adjust it able getting the name instead of id?
First, u can go to default.php
As you can see, the th is using a.id. U can modified it to name, which is the name you retrieve from.
But before that, you should inner join the table first if the component haven't join the table yet
Go to model
Example file location
Inner join the table
This is just an example
Logic:
inner join the dt_agent table to get the user id based on agent id
inner join the users table to get user name based on user id
After that, u need add the field in the function construct that u want to join like (c.ur_field_name)
why c.?
Becasue u join the table as c
Example:
Finally, after u inner join the table, then u can add the field_name into the th (which is field storing the name, not the id)
Now go to ur component, and try to click sort button, it already able to sort by name's asc or desc
Keypiont:
the sort by function is based on the column's th field, so u can direct adjust the field based on ur requirements