Cart Buy Licenses Contact Integrate into App Docs Support Login/Register
v 1.8.72
v 1.8.72
Overview Examples Docs Source Download

Ranking

A question for drag and drop ranking. Allows respondents to rank items against each other by placing them in order of preference. Is appropriate for short lists (e.g. 5-7 items). Is optimized for use with keyboard (Tab, Shift-Tab, and Up/Down arrow keys) and under mobile devices.


                        
        
            Survey.StylesManager.applyTheme("default");
        


            
                var json = {
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "ranking",
          "name": "smartphone-features",
          "title": "Please rank the following smartphone features in order of importance:",
          "isRequired": true,
          "choices": [
            "Battery life",
            "Screen size",
            "Storage space",
            "Camera quality",
            "Durability",
            "Processor power",
            "Price"
          ]
        }
      ]
    },
    {
      "name": "page2",
      "elements": [
        {
          "type": "checkbox",
          "name": "car",
          "isRequired": true,
          "title": "What cars have you being drived?",
          "colCount": 4,
          "choicesOrder": "asc",
          "choices": [
            "Ford",
            "Vauxhall",
            "Volkswagen",
            "Nissan",
            "Audi",
            "Mercedes-Benz",
            "BMW",
            "Peugeot",
            "Toyota",
            "Citroen",
            "Tesla"
          ]
        },
        {
          "type": "ranking",
          "name": "bestcar",
          "isRequired": true,
          "visibleIf": "{car.length} > 1",
          "title": "What car did you enjoy the most?",
          "choicesFromQuestion": "car",
          "choicesFromQuestionMode": "selected"
        }
      ]
    }
  ]
};

                window.survey = new Survey.Model(json);
            
        
            survey.onComplete.add(function(sender) {
            document.querySelector('#surveyResult').textContent =
            "Result JSON:\n" + JSON.stringify(sender.data, null, 3);
            });
        
        
            var app = new Vue({
            el: '#surveyElement',
            data:
            {
            survey: survey
            }
            });
        

                    
<!DOCTYPE html>
<html lang="en">
<head>
    <title>A question for drag and drop ranking. Allows respondents to rank items against each other by placing them in order of preference. Is appropriate for short lists (e.g. 5-7 items). Is optimized for use with keyboard (Tab, Shift-Tab, and Up/Down arrow keys) and under mobile devices., Vue Survey Library Example</title>

<meta name="viewport" content="width=device-width" />
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <script src="/DevBuilds/survey-vue/survey.vue.min.js"></script>
    <link href="/DevBuilds/survey-core/survey.min.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="./index.css">

</head>
<body>
    
            <div id="surveyElement" style="display:inline-block;width:100%;">
                <survey :survey='survey' />
            </div>
    <div id="surveyResult"></div>

<script type="text/javascript" src="./index.js"></script>

</body>
</html>