fix error
This commit is contained in:
parent
0d8972ea29
commit
f072515fa7
|
@ -49,15 +49,16 @@ class TableEntry
|
|||
if (field=='created_at' || field == 'sort_number')
|
||||
if column_entries.nil?
|
||||
values = self.order_by({field => direction})
|
||||
if !per.nil?
|
||||
values = values.page(page_num).per(per)
|
||||
end
|
||||
else
|
||||
values = column_entries.map{|v| v.table_entry}
|
||||
values = values.sort_by{|v| v.send(field)}
|
||||
if direction == 'desc'
|
||||
values = values.reverse
|
||||
end
|
||||
values = Kaminari.paginate_array(values,limit: values.count)
|
||||
end
|
||||
if !per.nil?
|
||||
values = values.page(page_num).per(per)
|
||||
end
|
||||
else
|
||||
column_to_sort = field
|
||||
|
|
Loading…
Reference in New Issue