Extending table columns in collection view in Plon

2020-05-09 18:54发布

问题:

Collections provide an option to select columns to be display within the table view of collection.

We are extending most content-types with two fields using archetypes.schemaextender: teaser image and teaser text.

  • Is there a sane way to extend the list of available table columns?

  • Is there a way to display the teaser text and teaser image inside the table view of the collection with out further customization? Is the logic of the table view flexible enough in order to support a schema extension?

回答1:

You might want to take a look at collective.formcriteria. I haven't polished it nearly enough and installing it can get you in some uninstall trouble so don't install it without first backing everything up. That said, it gives you more than enough rope to do what you want using column expressions. Of course this is also more than enough rope to hang yourself with.



回答2:

In the control panel -> collections ( typically /portal_atct/atct_manageTopicIndex) you can define every metadata you need. Collections depends on portal_catalog metadata and indexes, so you've to add your custom fields there. Use GenericSetup in your module profile to tell ZCatalog to create the new indexes, or create them by hand. In the former case, beware that reinstalling the module could wipe out the new created indexes ( http://maurits.vanrees.org/weblog/archive/2009/12/catalog ).