[ckan-dev] ckanext-scheming multiple_selected display issue (displays as an array)
Matthew Fullerton
matt.fullerton at gmail.com
Sat Nov 17 09:57:22 UTC 2018
Did you get this sorted? I wrote an unpublished blog post a while ago on
how to deal with this all and could see if I can get it out there...
Best,
Matt
On Thu, 6 Sep 2018 at 07:41, Biz Tweets <optweets at gmail.com> wrote:
> Please see (https://github.com/ckan/ckanext-scheming/issues/139) for more
> information
>
> If you set a field group in dataset.json to a multiple selected present
> such as
>
> "preset": "multiple_select" or "preset": "multiple_checkbox"
>
> It seems to save the selected options into an array and will display in an
> array on the facet list on the left hand side as so below:
>
> I followed what vithalalapati said and made a custom plugin with the
> following below:
>
> The facets_dict that im trying to print which has multiple selected fields
> is customer_area. Yet its still printing the facets_list in an array as so
> "["consumerdiscretionary", "consumerstaples"]"
>
> Because of this when you click it, it searches for the entire array rather
> than individually such as consumerdiscretionary or consumerstaples.
>
> Does anyone know or have a suggestion of how to save multiple selected
> fields in a non array fashion or display them in a non array fashion?
>
>
> class FacetViewPlugin(plugins.SingletonPlugin):
> plugins.implements(plugins.IConfigurer)
> plugins.implements(plugins.IFacets, inherit=True)
> plugins.implements(plugins.ITemplateHelpers)
>
> def update_config(self, config_):
> toolkit.add_template_directory(config_, 'templates')
> toolkit.add_public_directory(config_, 'public')
> toolkit.add_resource('fanstatic', 'facetview')
>
> # IFacets
> def dataset_facets(self, facets_dict, package_type):
> # We will actually remove all the core facets and add our own
> facets_dict.clear()
> facets_dict['file_type'] = plugins.toolkit._('File Type')
> facets_dict['allowed'] = plugins.toolkit._('Allowed?')
> facets_dict['organization'] = plugins.toolkit._('Organization')
> facets_dict['cert'] = plugins.toolkit._('Cert')
> #This one prints as an array below:
> facets_dict['customer_area'] = plugins.toolkit._('Customer Area')
> facets_dict['tags'] = plugins.toolkit._('Tags')
> return facets_dict
>
>
> Thanks!
>
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20181117/d4ab60b2/attachment.html>
More information about the ckan-dev
mailing list