This is a migrated thread and some comments may be shown as answers.
passing data between 2 kendo observable viewmodel of different scope
1 Answer 19 Views
This is a migrated thread and some comments may be shown as answers.
Neeraj
Top achievements
Rank 1
Neeraj asked on 10 Jan 2018, 03:56 AM
Hello,
   1) I want to know how can pass data from javascript object to kendo Observable  (MVVM) defined in a function like below passing data of temp to 

var temp= "a";   // can be array ['a','b'] or simple object "a" or {"name": "a" , "address":"b"}
function foo(a, b) {
    kendo.ui.progress($("body"), true);
    
        var viewModel = kendo.observable({
                           ModelItems: new Array(),
                            TestEventListener: function (e,data) {
                                debugger;
                                viewModel.push(data);
                            },
                            pushData: function(e) {
                                debugger;
                            }
        });
}


2) Passing data between 2 in different like below passing data of to viewmodel2 

function foo(a, b) {
    kendo.ui.progress($("body"), true);
    
        var viewModel = kendo.observable({
                           ModelItems: new Array(),
                            TestEventListener: function (e,data) {
                                debugger;
                                viewModel.push(data);
                            },
                            pushData: function(e) {
                                debugger;
                            }
        });
}
function bar(a, b) {
    kendo.ui.progress($("body"), true);
    
        var viewModel2 = kendo.observable({
                           ModelItems: new Array(),
                            TestEventListener: function (e,data) {
                                debugger;
                                viewModel.push(data);
                            },
                            pushData: function(e) {
                                debugger;
                            }
        });
}



1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 11 Jan 2018, 04:31 PM
Hello Neeraj,

The following forum thread reply shows how share data between viewmodels. If this does not help you to achieve the desired result, could you provide more details about what you are trying to achieve.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MVVM
Asked by
Neeraj
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or