fix error

This commit is contained in:
邱博亞 2022-03-05 21:26:42 +08:00
parent 0d8972ea29
commit f072515fa7
1 changed files with 4 additions and 3 deletions

View File

@ -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