You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
Hi,
I'd like to sort table of patiens with lastname, firstname in the same
column.
Of course in the model Patient there are two columns, which I need
joined while sortable.
Is there any way to do that with SortHelper?
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
On 13 November 2014 15:30, Zdravko Balorda <li...@ruby-forum.com> wrote:
> Hi,
> I'd like to sort table of patiens with lastname, firstname in the same
> column.
> Of course in the model Patient there are two columns, which I need
> joined while sortable.
> Is there any way to do that with SortHelper?
Can you be more explicit in what you want to sort on? Do you want to
sort by lastname and then within those with the same lastname then
sort by firstname? If so then just specify something like
@patients.order(:lastname, :firstname)
Colin
Zdravko Balorda
unread,
Nov 13, 2014, 12:36:51 PM11/13/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
I use SortHelper which provides for sorting by any column of the table.
With patient name I would like to have only one column. The combined
column could be 'name' as in:
select ..., lastname||', '||firstname as name from patients... order by
name
This column does not appear in the table itself. It is concatenated
column. Ordering by name would also provide for correct ordering. Can I
fool SortHelper to use such a fake column (not in the model) to work
with?
Colin Law
unread,
Nov 13, 2014, 12:49:25 PM11/13/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
No idea as I don't know what SortHelper is, and a quick google
revealed nothing that looked in any way current. Why would you not
want to do this the most efficient way which is likely to be when
fetching from the database?
Note that if you just concatenate the columns you will be unlikely to
get what you want, as you need it to sort on lastname then firstname,
which may not be the case if you just concatenate the strings.