Hi,
I have function list_items(), I am trying to get the list items of my account and also i am joining to user table where i am trying to get its fields, I am getting the list items but not able to sort. I did use this $this->db->debug_query(); query is returning properly but it is not getting sorted, Please help me out
function __construct()
{
parent::__construct('account'); // table name
}
function list_items($limit = NULL, $offset = NULL, $col = 'account.id', $order = 'asc')
{
$CI =& get_instance();
$userdata = $CI->fuel_auth->user_data();
$this->db->join('user', 'user.id = account.account_id', 'left');
$this->db->select('account.id, account.name as Table, user.name as "NAME", account.monthly, account.yearly as "Yearly", account.date');
$this->db->where("account.userid =".$userdata['id']);
$this->db->order_by('account.id', 'desc');
$data = parent::list_items($limit, $offset, $col, '');
return $data;
}
Comments
parent::list_items($limit, $offset, $col, $order);
If you are needing to sort it by default you can use the "default_col" and "default_order" in you module's config.
Anyone know if this is a bug or if there's something I'm missing that might enable use of aliases?