Cannot add a photo to photoList array

Thread is closed for posting
2 posts, 0 answers
  1. bill
    bill avatar
    1 posts
    Member since:
    Mar 2013

    Posted 02 Dec 2016 Link to this post

    When the first application was built, it contained an array called photoList.  This array is the source for a listview object called photo-list.  the code will add an item to this object with the push command:

                       // simulator code, can remove when finished testing
                        var image = document.getElementById('lastImage');
                        if (photoModel.imageList.length >= 0) {
                        var widthMeasure = (photoModel.imageList.length + 1) * 100 + 5;
                        var scr = $("#photo-scroll-container");
                        var serverImage = "images/server_room" + Math.floor(Math.random() * 3) + ".jpg";
                        photoModel.imageList.push({ fileName: serverImage });
                        photoModel.selectedPhoto = serverImage;
                        image.src = serverImage;


    the html for this is :

        <div id="photo-list-div" hidden="hidden" style="height: 70px">
            <div id="photo-scroller" data-role="scroller" data-orientation="horizontal" style="height: 70px; z-index: 1000;">
                <div id="photo-scroll-container">
                    <div id="photo-list" data-role="listview" data-template="template" data-bind="source: imageList, events: { click: imageSelect }" ></div>

    Now this same code is being used in another app, but when except that the push command never adds the photo to the list.

    Please help.



  2. Preslav
    Preslav avatar
    506 posts

    Posted 07 Dec 2016 Link to this post

    Hello Cliff,

    The provided code looks good to me. Confirm that the photoModel.imageList variable is initially defined as an empty array. If it is, in order to continue my investigation, could you please check for any JavaScript runtime errors that are logged in the developer console? You can follow the steps outlined in this article to open the developer tools in the simulator.

    Additionally, it will help me a lot to isolate and eventually find a workaround for the problem if you provide a runnable sample application that clearly reproduces the issue. Alternately, you can share your real-life application. For this purpose, I'd recommend that you open a support ticket, which is private and comes with a guaranteed response time and share the application there. I will also ask for steps to reproduce the problem.

    Let me know of your findings.


    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top