backbone.js

Lazy load items with filtering

人盡茶涼 提交于 2020-01-14 09:31:37
问题 I am using Backbone.js to load 20 items at a time on the page, getting more items when you scroll down to the bottom until there are none left to fetch from the server. At the same time, I want an input field up top that as you type a name, it filters the items that match. The issue is, if you haven't scrolled to the bottom yet and fetched the full set, the input filter will only match the items that are currently on the page. What is the best solution technically and visually for combining

Dependency Injection vs. Managed Dependencies vs. Global Object

◇◆丶佛笑我妖孽 提交于 2020-01-14 09:24:11
问题 I'm working within a Javascript + BackboneJS (an MVC framework) + RequireJS framework, but this question is somewhat OO generic. Let me start by explaining that in Backbone, your Views are a mix of traditional Views and Controllers, and your HTML Templates are the traditional MVC Views Been racking my head about this for a while and I'm not sure what the right/pragmatic approach should be. I have a User object that contains user preferences (like unit system, language selection, anything else

Prepend models to collection

独自空忆成欢 提交于 2020-01-14 09:11:08
问题 I'm looking for an elegant way to prepend models to a collection when adding them. In the Backbone source code there is an unshift method to do just that, but the add method for adding models to a collection is too complex to simply extend. I'm building a slide show that depends on photos and tweets and should always show the newest on top, oldest last. Simplification of my problem: Initialize app, API call returns: apple, banana, lemon So, apple is the newest slide. The collection is built:

Prepend models to collection

北城余情 提交于 2020-01-14 09:09:27
问题 I'm looking for an elegant way to prepend models to a collection when adding them. In the Backbone source code there is an unshift method to do just that, but the add method for adding models to a collection is too complex to simply extend. I'm building a slide show that depends on photos and tweets and should always show the newest on top, oldest last. Simplification of my problem: Initialize app, API call returns: apple, banana, lemon So, apple is the newest slide. The collection is built:

How to correctly remove whatever is necessary from backbone view?

拥有回忆 提交于 2020-01-14 06:28:10
问题 Hey my attempt to remove everything was calling the close function in the search view file after triggering the previous or next functions with this.close() but it was removing the view completely affecting the navigate function... I was wondering how to go about removing everything after it is completed, otherwise the vent.on occurs multiple times in the router. Here is my router file: define([ 'jquery', 'underscore', 'backbone', 'views/page', 'models/search', 'views/search', 'text!templates

Uncaught Error: Bootstrap's JavaScript requires jQuery with requirejs

萝らか妹 提交于 2020-01-14 05:42:05
问题 I am getting this error that says jQuery is not defined. bootstrap.js:8 Uncaught Error: Bootstrap's JavaScript requires jQuerybootstrap.js:8 (anonymous function) Bootstrap v3.3.0 jQuery JavaScript Library v2.1.3 requirejs require.config({ shim: { 'backbone': { deps: ['underscore', 'jquery'] }, 'backbone-validation': { deps: ['backbone', 'jquery'] }, 'jquerymx': { deps: ['jquery'] }, 'bootstrap': { deps: ['jquery'] } }, paths: { 'jquery': '/public/js/lib/jquery-2.1.3', 'jquerymx': '/public/js

Backbone.js: Load multiple collections with one request

限于喜欢 提交于 2020-01-14 04:05:06
问题 At this time my code fetches each collection separately but given that the same requests are made together I would like it to load the collections in one request. This is what my request response would look like if I were to merge all: [{id: 5, milestoneName: 'some milestone', tasks: [{id: 1, taskName: 'first task', dueDate: 'Jan 15'}, {id: 2, taskName: 'second task', dueDate: ''}]},{id: 6, milestoneName: 'some other milestone', tasks: [{id: 3, taskName: 'third task', dueDate: 'Jan 16'}, {id:

Backbone.js: Load multiple collections with one request

断了今生、忘了曾经 提交于 2020-01-14 04:04:09
问题 At this time my code fetches each collection separately but given that the same requests are made together I would like it to load the collections in one request. This is what my request response would look like if I were to merge all: [{id: 5, milestoneName: 'some milestone', tasks: [{id: 1, taskName: 'first task', dueDate: 'Jan 15'}, {id: 2, taskName: 'second task', dueDate: ''}]},{id: 6, milestoneName: 'some other milestone', tasks: [{id: 3, taskName: 'third task', dueDate: 'Jan 16'}, {id:

Marionette, backbone js betting game

↘锁芯ラ 提交于 2020-01-14 03:07:29
问题 This is a betting game, made in backbone. I have a bounty of 100 to help me refactor it into a marionette based application. I am unsure where to start - in terms of reconfiguring the models, how to swap the views out to make them regions. I believe the steps would be to start with creating a new marionette application and router. var app = Marionette.Application.extend({ initialize: function(options) { console.log('My container:', options.container); } }); var app = new app({container: '#app

Typescript Backbone View Events do not fire

感情迁移 提交于 2020-01-14 01:40:25
问题 I'm trying to make a simple view to test with backbone. I've started with events, but no one fires. Why ? I've made already other things with backbone like routing etc. without problems. Thanks for your time. My backbone definitions are from -> this source <- module Views { export class MenuView extends Backbone.View { constructor(viewOptions?: Backbone.ViewOptions) { super(viewOptions); } el = document.body; events = { "click #Btn-Start": "navigate", "click #Btn-Software": "navigate", "click