Skip to content

Attribute vs member #7

@paultyng

Description

@paultyng

The docs for this seem to say it will change a "selected" attribute on the model but it seems to only set a member on that instance instead of in the attributes collection via set.

On Backbone.Picky.Selectable:

    select: function () {
      if (this.selected) { return; }

      **this.selected = true;**
      this.trigger("selected");

      if (this.collection) {
        this.collection.select(this);
      }
    },

Is this intentional? I have to override my view serialization to render to pass this every time, so seems undesirable, but maybe I'm missing something?

Is this so that a change event isn't also fired or something? I guess on a fetch you would lose the selection state as well, but that could be handled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions