Forums/New Features

Customizing database item list columns

Michael Slater
posted this on May 2, 2011, 10:18

As a first step toward allowing you to customize what information is displayed in database item lists in the control panel, we've added two config settings.

admin.cit.index.date.fields is the name of the config setting that determines whether the "created_at" (default) or "updated_at" date column is shown. This must be set to the name of the item type followed by the desired field. A comma delimited list can be provided to set multiple item types. For example:

product:updated_at, company:updated_at

admin.cit.index.comment.fields is the name of the config setting that determines whether or not the comment count column is displayed. To turn it off, set to false, using the same syntax as above:

product:false, company:false

 

Comments

User photo
Michael

Any word on when we will be able add a custom field as a column here?

November 1, 2012, 15:57
User photo
Michael Slater
Webvanta

Actually, we have just deployed that feature, but haven't yet gotten it publicly documented yet. Here's the essentials if you want to play with it:

Create a global setting named admin.cit.index.columns

Set the value of this setting to a JSON hash where the key is the cit name and the value is an array of label/fieldname/type hashes.

 

For example:

{"item_type_name": [{"label": "field 1 label", "fieldname":"field_1_name", "type":"text"},{"label": "field 2 label for related item", "fieldname":"field_2_name", "type":"related_single_item"},{"label": "field 3 label for taxonomy", "fieldname":"field_3_name", "type":"taxonomy"}]}.

This feature does not support all possibile field types, but it does support text, number, date, taxonomy, and related item types.

November 1, 2012, 16:06
User photo
Michael

Thanks Michael, that worked perfectly!

November 1, 2012, 20:06
User photo
Michael

One small bug I've noticed since implementing this is that I can't sort the columns by anything other than 'name', if I click on a column header for one of the custom item fields, the whole table disappears and I need to refresh the page. Any ideas?

November 1, 2012, 22:39
User photo
Michael Slater
Webvanta

Thanks for the bug report. We don't currently support sorting on custom columns. The bug is that is should do nothing, rather than the table disappearing.

November 2, 2012, 08:31