Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8910869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:48:09+00:00 2026-06-15T03:48:09+00:00

I have a multiselect dropdown that I’m rendering with Backbone. As user selects or

  • 0

I have a multiselect dropdown that I’m rendering with Backbone. As user selects or deselects options, I’d like those (de)selections to be saved asynchronously via Backbone.

I found Backbone.Picky, and thought it might be helpful in my endeavor, but I can’t seem to get it to detect selects.

In my FieldView‘s clicked function below, console.log(this.model.selected); always writes undefined to the log. Why?

    var Field = Backbone.Model.extend({
        initialize: function(){
           var selectable = new Backbone.Picky.Selectable(this);
           _.extend(this, selectable);
        }
    });

    var FieldView = Backbone.View.extend({
        tagName: "option",

        initialize: function(){
            _.bindAll(this, 'render');
        },
        events: {
            "click":"clicked"
        },
        clicked: function(e) {
            var data_type = this.model.get("DATA_TYPE");
            console.log(this.model.selected);    // why is this undefined?
            console.log("it's a " + data_type);
        },
        render: function(){
            this.$el.attr('value', this.model.get('COLUMN_NAME')).html(this.model.get('display_name'));
            return this;
        }
    });

Here’s a jsfiddle http://jsfiddle.net/EAZCt/2/ for more context.

Using Backbone, how can I asynchronously save the select-status of options in a multiselect list?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:48:11+00:00Added an answer on June 15, 2026 at 3:48 am

    Your model object doesn’t ever have “selected” property because you never select the model. I have never used Backbone.Picky but it seems that you could try:

    var FieldView = Backbone.View.extend({
        tagName: "option",
    
        initialize: function(){
            this.model.on('selected', this.selected, this);
        },
        events: {
            "click":"clicked"
        },
    
        clicked: function() {
            this.model.select();
        },
        selected: function() {
            var data_type = this.model.get("DATA_TYPE");
            console.log(this.model.selected);
            console.log("it's a " + data_type);
        },
        render: function(){
            this.$el.attr('value', this.model.get('COLUMN_NAME')).html(this.model.get('display_name'));
            return this;
        }
    });
    

    http://jsfiddle.net/hGEYL/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listbox with multiselect options. I populate it using the addItem function.
I have a had a couple of instances that jQuery.Multiselect will not render correctly
Hi i have to create some multiselect element in zend with same options. i.e.
I'm using jQueryUI multi-select Widget that draws a nice dropdown menu widget for multi-selects.
I have multi-select drop down list where in user can select multiple options, now
Its like I have multiselect option in Jqgrid in which i want to pass
I have a multiselect listbox and depending on how many elements user will choose
I have a Multi Select dropdown, from where users selects multiple items. On the
I have a multiselect in html file like this: <select multiple id=mymultiselect name=mymultiselect> <option
I have multiSelect drop down on my web page designed in JSP. End user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.