Backbone View Architecture - backbone.js

I have 2 parts in my application:
A grid of players each with a thumbnail to click which activates a detail view on the left side of the page.
Detail view - activated when player is clicked on grid.
The model is very straightforward and will be read only. (Player model and Players collection)
The way I am thinking of organizing views is as follows:
AppView - main view that fetches collection (to create grid) and populates the grid. (JSONP is done in model) and manages events for the grid such as pagination.
PlayerThumb View - The view that contains a thumbnail of player that can be clicked from inside the grid.
CardView - This view contains the players large picture as well as stats about the player.
My confusion is how do I communicate information to the card view when a player thumb view is clicked?
What is the responsibility of the AppView? Is it doing too much? Should I create a PlayerGridView? If this is the case, what would app view be used for?

Related

Updating Main Window from page in a frame

I'm currently developing a WPF application using the MVVM framework. And I have this functionality:
I have a main window which has a combo box and frame (where I put my pages) and a view model. One of the pages in that frame is where a user can add a data and these data are used to populate the combo box in the main window. My problem is how to automatically update the items in the combo box after adding a data from that page. Btw, this page has a different view model too.
Thanks.
You can establish an event in the page viewmodel for changed data. Then subscribe to those events within the window viewmodel and update the combobox items accordingly.
You have access to the parent window from iframe via window.top. You have to write this code in your page what you have loaded in iFrame.
window.top.document.getElementById("combobox_element_id").value='Your New Value';
best of luck
You can pass the Source DataContext of ComboBox (ObservableCollection) to page ViewModel so you can simply modify the collection from Page view model.

MS Access: Accessing data from multiple tables in a tabbed form

I have an inventory system in MS Access 2010, and am trying to make a form that accesses multiple tables. Here is the relevant part of the data relationships printout:
I have a tabbed form that I am using that, for each food item, allows our orderers to edit/view the food purchasing data for that food item, or edit/view the inventory data for that food item. This is what that looks like:
So, currently, the parent form is using [Food items] as the control source. I want the tabs to basically display (and update when edited) the appropriate data from the [Inventory] and [Food purchase data] tables for that food item. So for instance, in the example above, the Food purchase data tab should be searching for the record for Agave in the [Food purchase data] table, and using that to populate the fields for that tab (and likewise for the inventory tab).
What is the best way to go about this?
Simply, use subforms inside your tabs, maintaining Food Items as the main form's recordsource. Remember, forms are essentially visual representations of tables. So on the main form, build separate forms for Inventory and Food Purchases and then link them just as you do in relationships.
How to specifically integrate subforms on main form?
Build subforms as separate regular forms, either as single, multiple-item, or datasheet. Don't place anything in page header/footer as they will not show on main form. You can use form header/footer.
Then in design view of Food Items main form, go to the tab control and select tab area, making sure yellow outlines appears, then locate the subform/subreport control in menu in Design tab on ribbon (looks like a newspaper icon if you scroll towards the end). Select the form specific to tab.
Walk through wizard, setting up the parent/child linked ids which you can also do on each subform control's Data tab in Property Sheet. Now, form will appear in its own design view where you can stretch out, re-position, and manage its own controls accordingly.

Using a UIPageViewController with an embed segue

I'm working on a client project that uses UIPageViewControllers.
The app has a hierarchy of "collection" view controllers that the user navigates through to get to (in this case) a page view controller that contains pages of content.
My design is to have the hierarchy of "collection" view controllers be custom subclasses of UIViewController that know how to manage collections of child view controllers with the client's desired UI.
My view controller that displays a page view controller is a subclass of my parent collection view controller, and that parent view controller class might manage page view controllers, cover-flow style view controllers, table view controllers, or a variety of others.
Ok, so I can't make my view controller that manages a page view controller a subclass of both my parent view controller and of UIPageViewController.
This is an iOS 6 project, so I decided to make my view controller contain a page view controller using an embed segue. That handles the housekeeping of parent/child view controllers painlessly, or so I thought.
However, the client wants a page curl transition in the view controller, and it seems that you can't change the transition of a page view controller after initializing it, nor can you specify the navigation orientation, spine location, etc.
Hmm. Seems I am in a catch 22.
Does anybody know of a way to use an embed segue to embed a page view controller as a child of another view controller and control the settings you get with initWithTransitionStyle:navigationOrientation:options: ?
At this point I might need to abandon the embed segue and manage the parent/child view controller relationship manually, which is a fair amount of work, especially when you deal with forwarding auto-rotation and other messages from parent to child.
Ok, problem solved.
There ARE settings in IB for a UIPageViewController that let you control the transition style, navigation orientation, and options.
The problem is that when I created a container view in my parent view controller, IB created a generic UIViewController as the child and I changed it's type to UICollectionViewController. When I did that the settings stayed those for a generic UIViewController.
I had to delete the generic child UIViewController that IB created, drag a UIPageViewController scene into the storyboard, then control-drag from the collection view onto my new UIPageViewController and select "embed" as the type of segue I wanted. When I did THAT, it gave me the settings I needed.

UISplitViewController does not recognize device rotation when covered by modal movie player

[This was posted on the Apple Developer Forums but has not been answered, so I'll try here.]
My application uses a UISplitViewController for iPad master/detail views and runs on iOS 6. The split view controller is the root view controller for its window. The detail view consists primarily of a UIWebView embedded in a UINavigationController. The only other elements in the detail view are the toolbar and navigation bar offered by the navigation controller. When the web view is displaying a page with an embedded YouTube video, the user can make the video full screen. This is all done by the UIWebView---I am not responsible for creating a full-screen video player. In case it matters, once the video player is placed in a full-screen view, the keyWindow of the UIApplication shared instance is not the main application window during video playback, but is instead an instance of MPFullScreenTransitionViewController.
If the user rotates the device during this full-screen playback, and then ends playback, the UISplitViewController does not properly place its children. The methods
splitViewController:willHideViewController:withBarButtonItem:forPopoverController:
and
splitViewController:willShowViewController:invalidatingBarButtonItem:
of the delegate (in this case, the detail view controller) are never called.
If the device was rotated to a landscape orientation while playing full-screen video, dismissing the movie player results in the presentation of a detail view controller that retains its former bar button item to draw the master view controller in a popover (although tapping the button produces no action). Where the master view controller should be drawn, only a black region exists. Swiping right in the detail view controller will slide out the master view controller that covers the black region, but this still exists as a popover rather than a persistent view.
If the device was rotated to a portrait orientation while playing full-screen video, dismissing the movie player results in the presentation of a detail view controller that lacks a bar button item to draw the master view controller in a popover. The detail view controller has the correct width, and the master view controller is not visible, so the appearance of the detail view is almost as expected except for the missing bar button item.
In both cases, manually rotating the device after the incorrect view appears will restore proper application functionality. However, relying on the user to rotate (or double-rotate) the device to fix drawing problems is clearly unacceptable.
Is there some way to ensure that the split view controller becomes aware of device rotations when all of its children have disappeared behind a modal movie player?
The answer was suggested by user SamuraiZack on the Apple Developer forums. In the delegate for UISplitViewController, force relayout of the split view controller in viewWillAppear:
[self.splitViewController.view setNeedsLayout];
[self.splitViewController.view layoutIfNeeded];
The original response can be viewed on the Apple Developer forums.

backbonejs menu from models belonging to different collection

I am developing a Backbonejs app using the excellent Marionette plugin.
I have a big navigation view consisting of <a> tags referencing various collections. An example will better explain this:
Cars
Car A
...
Car Z
Books
Book A
...
Book Z
Each block is a collection of models. Eg. CarList, BookList
How do i best architect the Menuview so that, whenever any of the model changes in any of the collection the Menu view is rerendered?
Maybe you could try to use a Composite View for your menu view and a Collection View for every sub-folder of your menu. Composite and Collection Views are made in a way that they will add/remove automatically a child element when a model is added/remove to the collection.
For more information you can check here: http://lostechies.com/derickbailey/2012/04/05/composite-views-tree-structures-tables-and-more/

Resources