3

I've written an extension for VSTS/TFS which adds a context menu for creating child work items. The creation of the work items works well, but the change is not reflected in the Grid/Board until I perform a Refresh of the entire page.

Is there a way to refresh just the affected work items (somewhat similar to the refresh performed by the '+' menu item)?

Community
  • 1
  • 1
shayc
  • 121
  • 9
  • What do you mean refresh of the entire page? Do you mean refresh whole grid control or whole extension page? The grid control need to be refresh after source changed. There is suppressRedraw parameter in setDataSource() method that indicate whether redrawn after data source is set. – starian chen-MSFT May 22 '17 at 06:32
  • 1
    My extension is not displaying a grid control. It is simply adding some context menu items to the existing backlog grid/board. The menu items create new child work items and the only way to make them show up is refresh the entire page (I'm using the NavigationService.reload() method). I would really like to avoid a full page reload and only refresh the affected work items on the backlog grid/board. How can I do that? – shayc May 22 '17 at 11:00

3 Answers3

1

There isn't any way to achieve this. If you open two pages and click "+" button to add two different child workitems from the two pages in the same time, you will find that the affected work item is not real refreshed, it just show the new added one. And you cannot control the behavior on Grid/Board either since the VSTS extensions are hosted in iframe which is cross-origin.

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • Is there a way to mimic the "+" button? This will at least show the added child. Pehpas some service similar to the WorkItemFormService? Currently I'm using the WIT REST Client createWorkItem method. – shayc May 25 '17 at 13:37
  • 1
    @shayc No for now. There is already a similar feature request for this on VSTS User Voice site. You can vote it here: https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/17023597-refresh-backlog-and-board-when-saving – Eddie Chen - MSFT May 26 '17 at 01:32
0

As far as I know this is currently not possible.

I struggled with that question for quite some time before I gave up and just told my users to hit F5 after creating the new work items. The NavigationService is the best alternative i know of.

Flex
  • 577
  • 2
  • 8
  • This is very dissapointing. Can someone from MSFT comment on this. Is this a definitive answer? – shayc May 24 '17 at 06:26
0

For your specific case, this doesn't help you. However, if anyone runs across this question looking for ways to refresh a work item, you can use the work item form service method "refresh":

https://www.visualstudio.com/en-us/docs/integrate/extensions/reference/client/api/tfs/workitemtracking/services/workitemformservice#refresh

This service is a means to interact with the currently active work item form. So, this refresh will work on a work item that the user has opened.

Casey23
  • 13
  • 1
  • 3