Carousel missing photos randomly after an upload.

Posted by: roger.porter on 1 November 2020, 9:14 pm EST

  • Posted 1 November 2020, 9:14 pm EST

    Hi,

    I have started to have issues with the carousel. Basically when they end user uploads photos it adds them to the carousel but now and then it does show them all. Below is my code snippet:-

    $.ajax({
    type: "POST",
    url: "CICMaint.aspx/ShowPhotos",
    data: "{'CICRefNo':'" + CICRefNo + "'}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    async: false,
    cache: false,
    success: function (response) {
    var htmlstr = "";
    //Clear Carousel Down
    $(".wijmo-wijcarousel-item").each(function (e, args) {
    $(this).remove();
    });
    $("#Carousel").c1carousel("refresh");
    if (response.d.length >= 1) {
    for (var photocount = 0; photocount <= response.d.length - 1; photocount++) {
    htmlstr = "<li><a href='" + response.d[photocount].Path + response.d[photocount].Name + "'><img src='" + response.d[photocount].Path + response.d[photocount].Name_tb;
    htmlstr = htmlstr + "?time=" + new Date();
    htmlstr = htmlstr + "' title style='border-width:0px;' role='img' class='wijmo-wijcarousel-image'/></a><span>" + response.d[photocount].PhotoRefNo + "</span></li>";
    $("#Carousel").c1carousel("add", htmlstr, photocount);
    }
    $("#Carousel").c1carousel("refresh");
    $("#Carousel").c1carousel("scrollTo", PhotoSequenceNo);
    $("#Carousel").c1carousel({
    itemClick: function (e, data) {
    CarouselPhotoIndex = data.index;
    }
    });
    $(".wijmo-wijcarousel-item a").click(function (e) {
    e.preventDefault(); //Avoids opening of image in a new page
    PhotoRefNo = $(this).parents('li').children('span').text();
    LoadPhoto(PhotoRefNo);
    });
    LoadPhoto(response.d[PhotoSequenceNo].PhotoRefNo);
    if ($("input[id*='inpSiteActivated']").val() !== "0") { //Site activated
    if ($("#cboStatus").val() == 0) { //CIC in Draft.
    PhotoButtonState('enabled', false, false, false);
    } else {
    PhotoButtonState('disabled', true, true, true);
    }
    } else {
    PhotoButtonState('enabled', false, false, false);
    }
    } else {
    if ($("input[id*='inpSiteActivated']").val() !== "0") { //Site Activated.
    if ($("#cboStatus").val() == 0) { //CIC in Draft.
    PhotoButtonState('disabled', true, false, true);
    } else {
    PhotoButtonState('disabled', true, true, true);
    }
    } else {
    PhotoButtonState('disabled', true, false, false);
    }
    Initialise_Photo();
    ResetBlobs(1);
    }
    $("input[id*='inpShowPhotos']").val('0');
    },
    error: function (xhr, status, error) {
    alert("AJAX Error (LoadPhotos): " + xhr.responseText);
    }
    });

    If you exit the browser and go back in it shows it.

    Many Thanks,
  • Marked as Answer

    Replied 2 November 2020, 9:41 pm EST

    Hello Roger,
    In the code snippet, there is an Ajax call which perhaps uploads the photos. Also, there is some method call for which we do not have any definition.
    It would be great if you may share a demo sample depicting your issue so that we may investigate it at our end.
    Thank you for your patience.

    Regards,
    Manish Gupta
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels