knockout.js - Perform lookup when ko postbox value published -


I started writing this question that I want to know how to set a lookup function when someone The properties of the view can be changed by the other view model, and now I ask how I am delivering this problem. In any case, this is my scenario:

I have a grid of an item on that page. The user clicks on a button to edit an item, and we show the popup window that contains all the original data, with detailed data about that record, which is not in the main grid object.

Edit window I have a separate overview of data for "copy of the work". When the user changes by clicking on the save button, then my plan is to copy over the original object so that the grid The changes appear.

I am currently using the ko.postbox library to communicate between two viewmodels. Both have been observed using "sync" to store that item that has been selected and kept in sync

Here it shows how it looks:

  function MainVM () {self = this; This.Item = K. Horoscope (). SyncWith ("GridItem"); This.Edit = function (item) {self.Item (item); }} Edit the function () (auto = this; it is selected Iitem = ko.observable). SyncWith ("GridItem"); This.WorkingItem = ko.observable (); This.RetrieveGridItemDetails = function (id) { // Ajax lookup to fill the working unit}  

When a user clicks to edit an item ... I like editing window VM (first with sync) ) But still get an AJAX lookup to pull up the rest of the item (how to do this ideas

I manually subscribe to that particular overview as well as being able to call different functions using a calculated calculation within the edit window view modal But I have been unable to find out a working solution: (

Am I going down the wrong path with the thinking of my current thinking or do anyone know That I cure that quest ?

I still am not able to work properly with the use of sync However, I have been able to get the lookup call using subscribeTo in the following fashion:

  selected itam = k.horbible & lt; Items & gt; (). SubscribeTo ("GridItem", true, (item) => {if (item! = Null) {this Retrieve Itam (item. Header id); Return Item;} Return new item ();});  

* Note: This is a typed script implementation.

Now it will allow me to continue, and I will do that when I come to that part, any synchronization problems Need to return back to the main VM.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -