surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.2k stars 809 forks source link

Ranking Question #2612

Closed dmitry-kurmanov closed 3 years ago

dmitry-kurmanov commented 3 years ago

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.

const json = {
  "questions": [
    {
      "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"
      ]
    }
  ]
};

new Survey.Model(json);

here the example: https://surveyjs.io/Examples/Library?id=questiontype-ranking

aanavaneeth commented 3 years ago

hi. This is cool. I have two points with respect to this. Is it possible to add dynamic options? (not just other but new dynamic choices.) Also, i am not sure how it works on touch screens. have you considered that?

dmitry-kurmanov commented 3 years ago

@aanavaneeth hello!

As for touch support, it should be ok. We've tested it on mobile devices.

As for dynamic choices could you please describe your scenario? Are you talking about something like matrix dynamic ? We have plans to add drag/drop functionality to matrices.

aanavaneeth commented 3 years ago

yes like dynamic matrix/panel. Having that feature is really useful because that way we can have dynamic option also to be ranked. I dont think drag drop on matrix is a replacement to this.

aanavaneeth commented 3 years ago

Recently I extended sortable list widget to achieve dynamic option feature. If you can add this feature to ranking, sortable list itself is not required at all for my requirement.

aanavaneeth commented 3 years ago

2640

dmitry-kurmanov commented 3 years ago

@aanavaneeth, could you please check our carry forward example https://surveyjs.io/Examples/Library?id=survey-carry-forward&platform=jQuery&theme=modern ? Now it contains ranking. And it is dynamic items in fact.

We have some problem with carry forward + ranking but we are working on the fix.

Could you also please share the example/screenshot with your extension for the list widget? It will help us better understand your use case.

aanavaneeth commented 3 years ago

dynamic option means users adding new options. not filtering kind of thing.

dmitry-kurmanov commented 3 years ago

@aanavaneeth we'll discuss it with the team

dmitry-kurmanov commented 3 years ago

@aanavaneeth we've discussed that idea with the team. And we think that it make sense especially for ranking. We also have the same feature request for the dropdown question (like select2). And we'll add the feature to our "todo". Here the issue: https://github.com/surveyjs/survey-library/issues/2666. Thanks.