rivets.js

Iterate over a collection of Backbone.js models using Rivets.js?

十年热恋 提交于 2020-01-04 02:41:06
问题 I'm using Rivets.js for two two-way data binding in a Backbone project and would like to implement iteration binding. The documentation suggests iteration binding is possible, but there are no examples available. I am using a simple Rails API to send JSON to the client and want to iterate over the contents. Has anyone had any success getting this functionality working in Rivets.js? Reference material: Simple Example using Backbone.js and Rivets.js jsFiddle here: http://jsfiddle.net/rhodee

Rivets, Backbone.View and Backbone.Collection

不羁的心 提交于 2019-12-24 03:54:14
问题 In the last view weeks I tried many ways to get Rivets work with Backbone.View and Backbone.Collection. All my tries where covered by examples I have found on the internet. But still, I'm not successful. Here is the challenge I currently try to realize: Making Rivets recognize Backbone.Collection(s) and getting all events observed Use a Backbone.View as template for Rivets which holds input fields for all objects in the Backbone.Collection Using all for this the "."-adapter of Rivets by

How to bind deeper than one level with rivets.js

泪湿孤枕 提交于 2019-12-18 02:49:27
问题 rivets.js newbie here. I want to bind to an item that will be changing dynamically (store.ActiveItem). I tried the following approach, but although store.ActiveItem is set, store.ActiveItem.(any property) is always undefined. Is there a standard way to bind deeper than one level? <div id="editItemDialog" data-modal="store.ActiveItem < .ActiveItem"> <a data-on-click="store:ClearActiveItem" href="#">close - works</a> <div> <div> <label>name:</label><input data-value="store.ActiveItem.Name <

Rivets and Spine js example

可紊 提交于 2019-12-13 04:57:39
问题 I am working on a Spine App that users rivets js in lieu of a templating engine and so far I am delighted with the rivets bindings, my views are more concise and readable and I have a clean separation of concerns: my controllers only take care of managing the state of the app, my models do the persistence stuff and my custom rivet bindings and formatters take care of formatting values and massaging user input. So far so good. My only concern is that I am using watch.js and I suspect watch is

How to print an array in rivets.js

自闭症网瘾萝莉.ら 提交于 2019-12-12 18:24:07
问题 I have data data = [{ "task": "get milk", "who": "Scott", "done": false }, { "task": "get broccoli", "who": "Elisabeth", "done": false }, { "task": "get garlic", "who": "Trish", "done": false }, { "task": "get eggs", "who": "Josh", "done": true }]; <ul> <li data-each-[]=""> </li> <ul> How could i print this data in rivets.js with 回答1: I think below example helps you. <ul id="playersList"> <li rv-each-player="players"> <dl> <dt>Name:</dt><dd>{ player.name }</dd> <dt>Surname:</dt><dd>{ player

Unable to add new field option to dobtco formbuilder plugin

最后都变了- 提交于 2019-12-11 12:34:28
问题 I am building a web application in which I am using this form builder plugin: https://github.com/dobtco/formbuilder. I am trying to add a new field option that will be visible in all form fields. Like this: Formbuilder.options = { BUTTON_CLASS: 'fb-button', HTTP_ENDPOINT: '', HTTP_METHOD: 'POST', AUTOSAVE: false, CLEAR_FIELD_CONFIRM: false, mappings: { SIZE: 'field_options.size', UNITS: 'field_options.units', LABEL: 'label', FIELD_TYPE: 'field_type', REQUIRED: 'required', ADMIN_ONLY: 'admin

How to bind two values using rivets(like some or condittion)?

不想你离开。 提交于 2019-12-11 08:59:34
问题 I want to bind two values to a DOM element using rivets like user.name and user.id so that it will take user.name if it is there or user.id if user.name is empty. Can someone tell me if this is possible?? 回答1: You could use a oneway binder to achieve this http://rivetsjs.com/docs/guide/#binders An example is at http://jsfiddle.net/jWVDu/1/ <li rv-each-person="people" rv-data-pid="person.id"> <span rv-nameorid="person.name"></span> Basically set up a new data attribute for the id (rv-data-pid)

Rivets.js: When button is clicked, call a function with an argument from a data binding

一曲冷凌霜 提交于 2019-12-08 17:36:02
问题 This is so infuriating. It seems like it should be so simple, but I can't find the magic incantation. Here's the gist of what I need to do: <div rv-each-thing="data.things"> <input type=button value="Click" onclick="abc( {thing} )"> </div> That should illustrate what I need to do. I've tried many different things, but nothing seems to work. 回答1: Below is the default configuration of event handler from rivets website: // Augment the event handler of the on-* binder handler: function(target,

Simple Example using Backbone.js and Rivets.js

依然范特西╮ 提交于 2019-12-07 09:25:01
问题 I am looking for a very simple example where e.g. there is a two way binding between span text and an input element using Backbone.js and Rivets.js. Perhaps there is one in the Rivets.js docs, but I can't find it. Any help please? 回答1: Assuming that you mean a two-way binding (model-to-view and view-to-model) on an input element and a one-way binding (model-to-view) on a span element, then the following view will do what you describe. <div id="user-view"> <span>{ user:name }</span> <input rv

Simple Example using Backbone.js and Rivets.js

送分小仙女□ 提交于 2019-12-05 14:56:16
I am looking for a very simple example where e.g. there is a two way binding between span text and an input element using Backbone.js and Rivets.js . Perhaps there is one in the Rivets.js docs, but I can't find it. Any help please? Assuming that you mean a two-way binding (model-to-view and view-to-model) on an input element and a one-way binding (model-to-view) on a span element, then the following view will do what you describe. <div id="user-view"> <span>{ user:name }</span> <input rv-value="user:name"> </div> Here is a fiddle that demonstrates things in action. It includes a Backbone