jbox-web/ajax-datatables-rails

Is it possible hide/show column conditionally ?

NeimadTL opened this issue · 1 comments

I know how to pass variable from my controller to the datatable like this:
render json: UserDatatable.new(params, users: users, context: view_context, admin: current_user.admin?)
get it back like that:

def current_user_admin?
    options[:admin]
end

but how can I use this boolean to hide or show an entire column please ?
I've also found this but not sure it's implemented in the gem

but how can I use this boolean to hide or show an entire column please ?
I've also found this but not sure it's implemented in the gem

This is how to do :) It belongs to the "view" side of DataTables. The gem's role is only to generate JSON data that will be treated by DataTables.