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

Using contextParameters in nuxeo-checkbox-aggregation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Not A Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Web UI

      Description

      It's useful to use contextParameters in nuxeo-checkbox-aggregation labels.

      Example: if we want to display a different label in the search helping from `ourEnricher`.

      Code we made to add this feature :

      _computeBuckets(data) {
          if (data) {
              const buckets = data.extendedBuckets;
              const selectedBuckets = data.selection;
              buckets.forEach((item, index) => {
                  item.checked = selectedBuckets.indexOf(item.key) >= 0;
                  item.label = this._computeLabel(data.buckets[index]); // <=###
              });
              ...
              return buckets;
          }
      },
      
      _computeLabel(item) {
          let i18nKey;
          if (item.fetchedKey) {
              const entry = item.fetchedKey;
      
              // ###
              const lang = window.nuxeo.I18n.language || 'en';
              if (entry.contextParameters && entry.contextParameters.ourEnricher) {
                  return entry.contextParameters.ourEnricher.field[lang];
              } 
          ...
          }
      },
      

      What do you think ?

       

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m