admin_data icon indicating copy to clipboard operation
admin_data copied to clipboard

Create custom hooks as a column

Open THEY opened this issue 14 years ago • 3 comments

As per the wiki, we are able to create new columns, for proc'd data, as per the example:

config.columns_order = { 'User' => [:id, :phone_numbers] }
config.column_settings = {'User' => { :phone_numbers => lambda {|model| model.phone_numbers.map {|r| r.number}.join(', ') } } }

Is it possible to create a completely new column that doesn't exist as model to provide a hook into our application? As per the following:

config.columns_order = { 'User' => [:id, :custom_hook_column] }
config.column_settings = {'User' => { :custom_hook_column => 'my_app_hook_path/' + :id } }

THEY avatar Feb 07 '11 20:02 THEY

It should be possible to create a new column that does not really exist as a column in the table.

If you run into any problem then let me know and I will look into this issue.

neerajsingh0101 avatar Feb 07 '11 20:02 neerajsingh0101

I'm getting an undefined method for "custom_hook_column" at admin_data-1.1.10/app/views/admin_data/search/search/_listing.html.erb where line #29

THEY avatar Feb 07 '11 21:02 THEY

I will look into this tonight.

neerajsingh0101 avatar Feb 07 '11 21:02 neerajsingh0101