passing data between 2 kendo observable viewmodel of different scope

2 posts, 0 answers
  1. Neeraj
    Neeraj avatar
    86 posts
    Member since:
    May 2015

    Posted 09 Jan Link to this post

    Hello,
       1) I want to know how can i pass data from javascript object to kendo Observable Viewmodel (MVVM) defined in a function like below passing data of temp to viewmodel

    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 viewmodel in different scope ? like below passing data of viewmodel 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;
                                }
            });
    }



  2. Dimitar
    Admin
    Dimitar avatar
    390 posts

    Posted 11 Jan Link to this post

    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.
Back to Top