Problem with getByUid() - Can't access second level **

2 posts, 0 answers
  1. Niro
    Niro avatar
    1 posts
    Member since:
    Jan 2014

    Posted 01 Sep 2014 Link to this post

    Hi,

    I have a problem of accessing an data-source and level 2 of it using getByuid method.

    Event List -> Event -> Attendees List  
                                   -> Schedule List

    *************************************************************************************************
    Click here for the Video of the Problem - http://screencast.com/t/MZCRUIiZm
    *************************************************************************************************

    I Want to access an attendee from an event. I basically do a getByUid() request but I can't get the attendee data object. It says UNDEFINED. I have a function called activity.alertMe for this.

    Please let me know why getByUid can't access this and it says undefined. How can I get the Attendee block ?

    Thanks.

    ACTIVITY
    /**
     * Activity view model
     */
     
    var app = app || {};
     
    app.Activity = (function () {
        'use strict'
         
        var activityViewModel = (function () {
             
            var activityUid;
        
     
            var show = function (e) {
                 
                activityUid = e.view.params.uid;
                var xid = e.view.params.xid;
                var yid = e.view.params.yid;
                 
                 
                // Get current activity (based on item uid) from Activities model
                var activity = app.Activities.activities.getByUid(activityUid);           
                var listviews = this.element.find("ul.km-listview");
                 
                $("#select-period").kendoMobileButtonGroup({
                    select: function() {
                        listviews.hide()
                        .eq(this.selectedIndex)
                        .show();
                    },
                    index: 0
                });
                 
                activity.alertMe = function(e) {
                     
                var activityUIND = app.Activities.activities.getByUid(e.data.uid);   
                alert(JSON.stringify(activityUIND));
                     
                app.mobileApp.navigate('views/attendee.html');
                     
                };
                 
                kendo.bind(e.view.element, activity, kendo.mobile.ui);
       
            };
             
            // Navigate to activityView When some activity is selected
            var attendeeSelected = function (e) {
                alert('triggered');
              //  app.mobileApp.navigate('views/event.html?yid=1&xid=' + e.data.uid);
            };
             
            var alertMe = function (e) {  
                alert("Test");
            };
      
            return {
                show: show,
                attendeeSelected: attendeeSelected,
         
            };
             
        }());
         
        return activityViewModel;
         
    }());


    JASON

    callback([
       {
          "id":"18",
          "name":"Archmage Internship Programme.",
          "client_name":"279",
          "from_date":"2014-03-25",
          "to_date":"2014-03-28",
          "description_short":"Gain an invaluable insight into banking with a leading Software Company.",
          "description":"
     
    The Archmage<\/strong> Internship Programme is for students looking to gain an invaluable insight into banking with a leading global bank. The programme provides exposure, hands-on experience and on-the-job training to gain a head start in your career after graduation.<\/p>",
          "event_image":"http:\/\/mimtdemo.info\/event_app\/administrator\/components\/com_event\/assets\/uploads\/events\/5318669af0915archmage.jpg",
          "event_venue":"MIMT",
          "attendee":[
             {
                "id":"40",
                "event_id":"18",
                "name":"Amila Bandara",
                "email":"amila@archmage.lk",
                "nic":"8849854583V",
                "designation":"SE",
                "detail_profile":"Amila Bandara",
                "attendee_image":"http:\/\/mimtdemo.info\/event_app\/administrator\/components\/com_event\/assets\/uploads\/attendee\/531d79226a93damila.jpg"
             },
             {
                "id":"41",
                "event_id":"18",
                "name":"Nirosha Kodituwakku",
                "email":"nirosha@archmage.lk",
                "nic":"842460999v",
                "designation":"CEO",
                "detail_profile":"Niro is the CEO of Archmage (pvt) Ltd. We build products and MAS is our eFacility Management System. It will be an amazing product.",
                "attendee_image":"http:\/\/mimtdemo.info\/event_app\/administrator\/components\/com_event\/assets\/uploads\/attendee\/531d7c2a28e04Nirosha_Kodituwakku_small.jpg"
             },
             {
                "id":"42",
                "event_id":"18",
                "name":"Nirosha Aberyrathne",
                "email":"niroshaabey@archmage.lk",
                "nic":"842460995v",
                "designation":"PM",
                "detail_profile":"Nirosha is our Project Manager.",
                "attendee_image":"http:\/\/mimtdemo.info\/event_app\/administrator\/components\/com_event\/assets\/uploads\/attendee\/531d79a93552aNirosha.jpg"
             }
          ],
          "schedule":{
             "day":[
                {
                   "date":"1",
                   "item":[
                      {
                         "id":"43",
                         "name":"Program Start",
                         "from_date":"2014-03-25 10:00:00",
                         "to_date":"2014-03-25 10:30:00",
                         "description":"
     
    We will casually start the program by 10.30 am.<\/p>",
                         "schedule_image":"http:\/\/mimtdemo.info\/event_app\/administrator\/components\/com_event\/assets\/uploads\/schedule\/531d7d1167bb6Pic-1.jpg",
                         "venue":"Main Hall",
                         "attachments":[
                            {
                               "id":"81",
                               "name":"",
                               "url":"http:\/\/mimtdemo.info\/event_app\/administrator\/components\/com_event\/assets\/uploads\/sch_attachment\/531d7d506e3faQuestionnaire.docx"
                            }
                         ]
                      }
                   ]
                },
                {
                   "date":"2",
                   "item":[
                      {
                         "id":"44",
                         "name":"Second Day Opening",
                         "from_date":"2014-03-26 10:23:00",
                         "to_date":"2014-03-26 12:24:00",
                         "description":"
     
    MIMT Opening<\/p>",
                         "schedule_image":"http:\/\/mimtdemo.info\/event_app\/administrator\/components\/com_event\/assets\/uploads\/schedule\/",
                         "venue":"MiMT",
                         "attachments":[
                            {
                               "id":"82",
                               "name":"",
                               "url":"http:\/\/mimtdemo.info\/event_app\/administrator\/components\/com_event\/assets\/uploads\/sch_attachment\/531ede2ac2deepic-1.png"
                            }
                         ]
                      }
                   ]
                }
             ]
          }
       }
    ])


  2. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 04 Sep 2014 Link to this post

    Hi Niro,

    I am closing this thread as a duplicate of ticket with ID 855137.

    I suggest we continue our conversation there.

    Regards,
    Kaloyan
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top