Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-13611

Let "readonly" select2 property be forced by widget property

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.9.1
    • Fix Version/s: 5.9.2
    • Component/s: Layouts & Widgets

      Description

      The "selection formatter" and "inline javascript" are widget properties to customize the select2 suggestion box.

      Since view mode is readonly, select2 is not used to render the widget and it falls back to the way it was rendered in 5.6.

      But what is interesting with select2 is that you can easily customize the display of selected entries through js formatter and it'd be nice to customize the display in view mode.

      A workaround would be to force edit mode while in view mode and use the readonly select2 property to block the edition:

      Example:

      <widget name="pictures" type="multipleDocumentsSuggestion">
              <labels>
                <label mode="any">Pictures</label>
              </labels>
              <translated>false</translated>
              <fields>
                <field>album:pictures</field>
              </fields>
              <widgetModes>
                <mode value="view">edit</mode>
              </widgetModes>
              <properties widgetMode="edit">
                <property name="readonly">true</property>
                <property name="documentSchemas">dublincore,common,picture</property>
                <property name="query">select * from Picture where dc:title LIKE ?
                </property>
                <property name="suggestionFormatter">myPictureFormatter</property>
                <property name="width">412</property>
                <property name="selectionFormatter">myPictureFormatter</property>
                <property name="inlinejs">
                  <![CDATA[
                   jQuery(document).ready(function() {
                    jQuery('a.myCssClass').fancybox({'type':'image'});
                    jQuery('a.myCssClass2').fancybox({'type':'iframe'});
                   });
                  ]]>
                </property>
              </properties>
            </widget>
      

      The pbm is that the "readonly" select2 property is set in Select2Actions.encodeParameters method depending on the widget mode whatever is specified in the widget properties.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.