leikind / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
MIT License
537 stars 215 forks source link

Custom column defined through model, giving error in wicegrid... #216

Closed ddpdevang closed 9 years ago

ddpdevang commented 9 years ago

WiceGrid: Column 'total In Pounds' is not found in table 'invoices'! If 'total In Pounds' belongs to another table you should declare it in :include or :join when initialising the grid, and specify :model in column declaration.

class Invoice < ActiveRecord::Base
def totalInPounds
    return total*0.01
end
end

. . .

g.column name:  'Amount',attribute: 'totalInPounds', auto_reload:  true do |task| 
    number_to_currency task.totalInPounds, {:unit => "£"}
  end

.

.

How can I solve this error?

leikind commented 9 years ago
  1. Please start using github markdown for syntax highlighting. I am tired of editing your posts.
  2. Please read the documentation. It is all there. This is not an error. WiceGrid works with DB columns, not with your methods.
  3. Please stop bugging me with elementary questions which have no relation to WiceGrid errors. I get paid for work like. You can hire me if you want.
ddpdevang commented 9 years ago

Where can I discuss regarding paid work regarding this?

I want to use methods because I have some formatting that this methods are doing

leikind commented 9 years ago

The only way you can do this with WiceGrid is to have a second DB column the value you need is calculated and stored. It can be done via before_save in ActiveRecord or a database trigger.

Please send work related proposals to yuri.leikind{at}profy.be