3 Replies Latest reply: Sep 12, 2017 3:58 AM by Øystein Kolsrud RSS

    Dynamically create multiple qListObjectDef objects with array property

    Colin McKenna

      Hello all,

       

      I am just getting started creating qlik sense extensions, and I'm having a bit of trouble. I see that you can define multiple qListObjectDefs in the initialProperties section of an extension. But I am looking for a way to create a qListObjectDef for each Dimensions added in the properties panel using an array property. I have 2 main questions:

       

      1. How can I create qLIstObjectDef objects when a user adds a new item to an "array" property?
      2. How do i then assign the values from this array to a qListObjectDef

       

      My current code looks like this:

       

      initialProperties: {
      version: 1.0,
                      qListObjectDef: {
                          qShowAlternatives: true,
                          qFrequencyMode: "V",
                          qSortCriterias: {
                              qSortByState: 1
                          },
                          qInitialDataFetch: [{
                              qWidth: 1,
                              qHeight: 10000
                          }]
                      },
      myArray: []
      },
      
      definition: {
      type: "items",
      component: "accordion",
      min: 1,
      max: 1,
      items: {
      dimension: {
      type:"array",
      label:"Dimensions",
      ref: "myArray",
      itemTitleRef:"arrayLabel",
      allowAdd: true,
                              allowRemove: true,
                              addTranslation: "Add Dimension",
      items: {
      label: {
      type:"string",
      ref:"arrayLabel",
      label:"Label",
      show: true
      },
                                  field: {
                                      type: "string",
                                      expression: "always",
                                      expressionType: "dimension",
                                      ref: "arrayField",
                                      label: "Field",
                                      show: true
                                  },
      style: {
      ref: "vars.filterType",
      expression: "optional",
      translation: "Filter Type:",
      type: "string",
      defaultValue: "Checkbox",
      component: "dropdown",
      options: [{
      value: "Checkbox",
      label: "Checkbox"
      },
      {
      value: "Radio",
      label: "Radio"
      }]
                                  }
      }
      },
      appearance: {
      uses: "settings"
      }
      }
      },
      

       

      I am trying to create a functionality similar to the built in filter pane, that allows a user to define multiple dimensions in a single extension to use for filtering.

       

      Thanks,

      Colin