This is a migrated thread and some comments may be shown as answers.

Image in grid not refreshed after update

3 Answers 388 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jane
Top achievements
Rank 1
Jane asked on 29 May 2017, 03:22 AM

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.

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 31 May 2017, 05:13 AM
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() 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 (charts) and form elements.
0
Jane
Top achievements
Rank 1
answered on 31 May 2017, 06:21 AM

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).

0
Stefan
Telerik team
answered on 01 Jun 2017, 01:25 PM
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.
Tags
Grid
Asked by
Jane
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Jane
Top achievements
Rank 1
Share this question
or