Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get Drop Down menu values from the Sheets

Hi Every One ,

I am new in Qliksense , what's my question is if i drag and drop any Chart or Button on the Sheet in the property panel properties will change and on select any value in the drop down menu it will perform some action. so how to give the functionality of these properties

Thanks & Regards ,

Sai Madhumenu sheet.pngReddys310Naveen06

1 Solution

Accepted Solutions
reddy-s
Master II
Master II

Hi Sai Madhu,

This is what you need,

Untitled.png

Check this code:

define( ["jquery","qlik"], function ( $,qlik ) {

  'use strict';

   var list = []; 

  function getList(){

                                      var app=qlik.currApp();

                                      var xvalue;

                               var cnt = 0;

                               var Lvalues = [];

                                      var i = 0;

 

        app.getAppObjectList("sheet",function(reply)

                                           {

                            

  console.log(reply);

  for (i == 0;i < reply.qAppObjectList.qItems.length;i++){

  xvalue =  reply.qAppObjectList.qItems;

  Lvalues.value = xvalue.qInfo.qId;

  Lvalues.label = xvalue.qData.title;

  list.push(Lvalues);

  Lvalues = [];

  }

  

    });

                }

 

        getList();

 

  return {

  initialProperties: {

  qHyperCubeDef: {

  qDimensions: [],

  qMeasures: [],

  qInitialDataFetch: [{

  qWidth: 2,

  qHeight: 50

  }]

  }

  },

  //property panel

  definition: {

  type: "items",

  component: "accordion",

  items: {

  dimensions: {

  uses: "dimensions",

  min: 0,

  max: 1

  },

  measures: {

  uses: "measures",

  min: 0,

  max: 1

  },

  sorting: {

  uses: "sorting"

  },

   addons : {

                    uses : "addons",

                    items : {

   Scale : {

                            type : "string",

                            component : "dropdown",

                            label : "Scale",

                            ref : "Scale",

  options :   function(){

                                      debugger;

               return list;

  },

                            defaultValue : "Select"

                        }

  }

   },

  settings: {

  uses: "settings"

  }

  }

  },

  snapshot: {

  canTakeSnapshot: true

  },

  paint: function ( $element, layout ) {

  }

  };

} );

Thanks,

Sangram Reddy.

View solution in original post

40 Replies
reddy-s
Master II
Master II

HI Madhu,

Here is what you have to do.

As the drop down is created it must be having some values assigned to it.

Every time you change the properties in the properties panel the visualisations are re painted. Hence call a function some thing similar to the code below:

In the paint function, call an other function like this with the value of the drop down.

navigation_option(value);

function navigation_option(Code){

if (Code == Val1){

//Code to go to next sheet

} else if (Code == Val2){

//Code to Go to previous sheet

} elseif(Code == Val3){

//Code to go to a specific sheet

} elseif(Code == Val4){

// Code to go to a story

}elseif(Code == Val5){

//Code to open a website

}

}

Let me know if you need anything else.

Thanks and Regards,

Sangram Reddy.

Not applicable
Author

Hi Reddy,

Can you Give any demonstration for dropdown menu  in Property panel and once i select any value in dropdown menu the action performing on the sheet that type of functionality give one small demonstration.

Thank's & Regards,

Sai Madhu

Not applicable
Author

Hi Reddy ,

i was created the dropdown menu and the functionality give like show in below , But this functionality is not working so can you give any example


//property panel

  definition: {

  type: "items",

  component: "accordion",

  items: {

  sorting: {

  uses: "sorting"

  },

  settings: {

  uses: "settings"

  },

   Variable: {

                                type: "string",

                                component: "dropdown",

                                label: "Sheet Navigation",

                                ref: "Variable",

  options: [{

   label: "SelectSheet",

   Value:"Select"

  },

   {

                                    label: "GotoNextSheet",

                                    value: "Nextsheet"

                            }, {

                                    label: "GotoPreviousSheet",

                                    value: "PreviousSheet"

                            },

  {

                                    label: "GotoSpecificSheet",

                                    value: "SpecificSheet"

                            }],

                                defaultValue: "Select"

                            }

  }

  },

  snapshot: {

  canTakeSnapshot: true

  },

  paint: function ( $element, layout ) {

  

  

    navigation_option(value);

   function navigation_option(new)

   {

  if(code == Nextsheet){

   qlik.navigation.nextSheet();

  }else if(code == PreviousSheet)

  {

   qlik.navigation.prevSheet();

  }else if(code == SpecificSheet)

  {

    qlik.navigation.gotoSheet('JpNtX');

  }

   }

  //add your rendering code here

      navigation_option(value);

   function navigation_option(new)

   {

  if(code == Nextsheet){

   qlik.navigation.nextSheet('');

  }else if(new == PreviousSheet)

  {

   qlik.navigation.prevSheet('');

  }else if(new == SpecificSheet)

  {

    qlik.navigation.gotoSheet('JpNtX');

  }

   }

Regards,

Sai Madhu

Not applicable
Author

reddy-s
Master II
Master II

Sure Madhu.

Not applicable
Author

Hi reddy,

Thank's for your give support

Regards,

Sai Madhu

reddy-s
Master II
Master II

Hi Sai Madhu,

This is what you need,

Untitled.png

Check this code:

define( ["jquery","qlik"], function ( $,qlik ) {

  'use strict';

   var list = []; 

  function getList(){

                                      var app=qlik.currApp();

                                      var xvalue;

                               var cnt = 0;

                               var Lvalues = [];

                                      var i = 0;

 

        app.getAppObjectList("sheet",function(reply)

                                           {

                            

  console.log(reply);

  for (i == 0;i < reply.qAppObjectList.qItems.length;i++){

  xvalue =  reply.qAppObjectList.qItems;

  Lvalues.value = xvalue.qInfo.qId;

  Lvalues.label = xvalue.qData.title;

  list.push(Lvalues);

  Lvalues = [];

  }

  

    });

                }

 

        getList();

 

  return {

  initialProperties: {

  qHyperCubeDef: {

  qDimensions: [],

  qMeasures: [],

  qInitialDataFetch: [{

  qWidth: 2,

  qHeight: 50

  }]

  }

  },

  //property panel

  definition: {

  type: "items",

  component: "accordion",

  items: {

  dimensions: {

  uses: "dimensions",

  min: 0,

  max: 1

  },

  measures: {

  uses: "measures",

  min: 0,

  max: 1

  },

  sorting: {

  uses: "sorting"

  },

   addons : {

                    uses : "addons",

                    items : {

   Scale : {

                            type : "string",

                            component : "dropdown",

                            label : "Scale",

                            ref : "Scale",

  options :   function(){

                                      debugger;

               return list;

  },

                            defaultValue : "Select"

                        }

  }

   },

  settings: {

  uses: "settings"

  }

  }

  },

  snapshot: {

  canTakeSnapshot: true

  },

  paint: function ( $element, layout ) {

  }

  };

} );

Thanks,

Sangram Reddy.

Not applicable
Author

Hi reddy ,

What ever you send the code i was tried it .i got the result. But I'm looking into this way like ( once drag and drop image button) on the sheet that object properties will be shown in drop down menu ,and once we select any sheet  in the drop down menu after click image button then it will be navigate the that particular Sheet. i am looking this one as show in below picture

button property.pngReddys310

reddy-s
Master II
Master II

Hi Madhu,

As specified in the code above, each drop down label has been updated with its respective sheet id and that sheet ID can be fetched from the variable in the hypercube.(EX: in my code, "Scale" variable will have the value of the sheet selected in the drop down list).

Once you fetch the sheet id: make use of this code below.

$('#ImageID')

  .css('cursor', 'pointer')

  .click(

    function(){

  qlik.navigation.gotoSheet(Scale);// goes to sheet 1

    }

  )

Thanks and Regards,

Sangram Reddy.