Image in grid not refreshed after update

4 posts, 0 answers
  1. Jane
    Jane avatar
    15 posts
    Member since:
    Oct 2016

    Posted 28 May 2017 Link to this post

    I am displaying an image in a grid via a template and I use a web service to get that image.  After I have updated a row via the update popup, the image does not get refreshed.  I need to force the grid to call the web service again.

                {title: "Modified Drawing",
                 template: function(data){return getModifiedDrawingTemplate(data) },
                    filterable: false
                },
     
    function getModifiedDrawingTemplate(data) {
        var url = buildWebServiceUrl(retrieveDrawingUrl, data.CORR_DETAIL_ID, "new", "SVG", "250");
        return '<img src="' + url + '" />';
    }

     

    Could you please tell me how to do this?  The column is not bound to the data as such so I can't use the bind method.

  2. Stefan
    Admin
    Stefan avatar
    2880 posts

    Posted 31 May 2017 Link to this post

    Hello Jane,

    I can assume that this may be a timing issue.

    In general, when a row is updated via the popup the function in the template will be called and the content(img) will be changed accordingly.

    http://dojo.telerik.com/APAkU

    Please check if the item with the correct new URL is available in the function just before the return.

    If the issue still occurs, please send a fully runnable example, or modify the provided one, and I will gladly assist. 

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Jane
    Jane avatar
    15 posts
    Member since:
    Oct 2016

    Posted 31 May 2017 in reply to Stefan Link to this post

    Thanks Stefan,

    I can see that the function to get the template is being called after the update but, unfortunately in my case, the url hasn't changed after update so the web service doesn't get called again. Presumably that's a browser feature.

    I think I'm going to have to change the service to accept some kind of unique identifier which changes after update (the field that was updated to change the image is really long and we're trying to limit network traffic so can't use that).

  4. Stefan
    Admin
    Stefan avatar
    2880 posts

    Posted 01 Jun 2017 Link to this post

    Hello Jane,

    Another think that can be checked in this scenario is that the function in the template is calling another function to get the URL, please check if using only one function in this scenario will help.

    Also, the URL can be sent as a field in the dataSource, and it will be available together with the Grids data after the update.

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 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