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 8111177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:00:45+00:00 2026-06-06T02:00:45+00:00

I have a Backbone.js application that allows users to create graphs based on large

  • 0

I have a Backbone.js application that allows users to create graphs based on large datasets. There are several options presented to the user to allow for graph customization. Some of the options that the user may click set several attributes on the model.

Occasionally we have to create some of these graphs programaticaly- through loading or importing graphs from other applications. I’m not sure whether to trigger click events to set those attributes or to set model attributes directly. On one hand, it’s DRY to trigger the click event, but I’m not sure if that’s efficient/readable or violates MVC.

Is it bad practice to simulate a click in order to set model attributes? Or should I set the attributes on the model manually?

CODE:
View

...
events: {
  "click .defaultGraph": "setDefaultGraph"
}

, setDefaultGraph: function () {
      this.model.set({
        "type": "bar"
        , "otherAttribute": "foo"
        , "anotherAttribute": "baz"
      });
    }
...

My programmatic recreation of a default graph

this.$(".defaultGraph").click();

OR

this.model.set({
  "type": "bar"
  , "otherAttribute": "foo"
  , "anotherAttribute": "baz"
});
  • 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-06T02:00:46+00:00Added an answer on June 6, 2026 at 2:00 am

    It doesn’t matter. The click way is short and sweet. So, if the view isn’t going to change (which I know you can’t say with surety) then click way is fine. Otherwise, you may want to go for the latter way.

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

Sidebar

Related Questions

I am building a web application that have several requirements for the client: 1.
I have a web application that is currently using backbone.js 0.5.3 with backbone local
I have an application that does CRUD for a Collection of Models . There
I have a Backbone application that appends elements to the DOM. When I log
I have a simple backbone.js twitter application that needs to sort tweets in reverse
I have created a Backbone.js/Require.js application that dynamically loads HTML templates to use as
I'm developing application using backbone.js & jquery. I have following code in model: runReport:
I have Backbone.js collection that holds (for example) 30 items. I want to pass
I have backbone view that binds an action to an element in the DOM.
We have a backbone.js app that displays a number of forms to the 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.