I
I
Igor2015-12-25 17:35:20
backbone.js
Igor, 2015-12-25 17:35:20

How to reset external collection when rendering a view in backbone?

Hello! I have the following problem:
I have a view and a filter model, as well as a view, a model, and a list of documents collection. I need to have the filter view event reset the list collection to load the new collection into the list. If I used global variables, then everything would be easier, but it all works for me through require.js. Tell me, how can I connect a view with an external collection? Thank you.

Answer the question

In order to leave comments, you need to log in

8 answer(s)
A
Alexey Ukolov, 2015-12-25
@alexey-m-ukolov

Solutions, in general, three:
1. Pass the desired collection when initializing the view as a parameter.
2. Use the same global observer object, which passes the view as a dependency so that it generates events on it. And inside this global object, already call the desired method.
3. Use marionette.js, which already has this global object and many other useful things. You won't do better than there.

A
Alexander, 2016-02-02
@amyalichkin

answered here Interaction of different models and views in Backbone?
communicate via the message bus
or start your own and drag

define('dispatcher', ['underscore', 'backbone'], function (_, Backbone) {
  return _.clone(Backbone.Events);
});

require(['dispatcher'], function (dispatcher, ...) {
   ...
   this.listenTo(dispatcher, 'EVENT_NAME', this.myCallback);
   ...
   dispatcher.trigger('EVENT_NAME', data)
   ...
})

M
Michael Danilov, 2014-05-27
@Danil9500

Won't take off. It all comes down to people and security.
There is a non-zero chance that all network nodes will be offline, so if you connect your new device, you will not receive any of your data. You need at least a server (or a group of servers) for fault tolerance. If this is not the case, then each piece of data must be stored on all network nodes in order to achieve maximum data availability. If each person will store 1 GB, and there will be 100 people in total, then each person needs to store 100 GB. 99 for 1 is a bit pricey.
Security: now with conventional cloud storage, I understand that the point of departure of my data to the outside is either me or the service. With your own paradigm, these are several or all nodes of the system, even with crypting it’s scary to give data to someone who doesn’t understand.
Peering is ideal to give data that everyone needs at the moment: popular movies, music or programs, but not needed by one or two.

T
Trow_eu, 2014-05-26
@Trow_eu

1. why? at least one advantage, I did not understand where it is ideal.
2. how to run? someone's computer is turned off / there is no Internet / just deleted pieces - the data is not available / lost?

D
Danil9500, 2014-05-26
@Danil9500

1. No special services will get there
2. You can store the most frequently used files on some closer / faster / more accessible servers. Undoubtedly, you will have to make backups. For example, 1 custodian died, we copy from the second to the third so that the files are not lost.

P
Pavel Solovyov, 2014-05-26
@pavel_salauyou

do you want to store data on other users' hard drives? lol

A
Alexander, 2014-05-26
@yakupovak

Your idea is familiar to me. I thought about this service. True, there is no programmer knowledge, but there is admin knowledge + storage space.
Can you be a programmer or are there any programmers who can implement this?

D
deleted-rss1alex, 2015-07-27
@deleted-rss1alex

For self-development, you can search for "replacement debug update from Microsoft Windows" the wrong update makes the storage with hidden traffic. There are no bugs, I did not meet the changed characters. There were no errors. The update is constantly downloading something. Upon reaching 50 GB, I simply deleted it. After that, no errors occurred and I stopped receiving "compressed data" from the traffic intermediary (intruder). Recently I understood how it works and I don't know how to implement it. This is encrypted traffic. Some repeating code is written in one character, i.e., one letter. The user's character set "may not pose a danger to the user himself" and is forwarded to the next network. The code stopped downloading after deletion. The update remained and I just reinstalled the OS. ALL CODE THAT IS COMPRESSED LOCATED ON ANOTHER COMPUTER. I will need this method inside my own network using api. On most PCs, the api should be blocked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question