How to refresh the workitem which is accessed from the web after clicking on save ?

Unanswered How to refresh the workitem which is accessed from the web after clicking on save ?

  • Monday, March 26, 2012 5:51 AM
     
     

    After accessing the work item from web and added details in some of the fields in work item, is there a way to refresh the workitem page after clicking on save ?

All Replies

  • Monday, March 26, 2012 1:56 PM
     
     

    No, you just need to click the refresh button or press F5.


    We are volunteers, if the reply help you mark it as your answer. thanks!!

    Blog: http://mohamedradwan.wordpress.com

     

  • Monday, March 26, 2012 2:44 PM
     
     

    Hi Radwan,

    I tried that option, actually the requirement is once we add the content in details tab and then we click on "Save" button, the "Details" tab content is going to the right side "History" section and at the same instance "Details" tab content should be cleared.

    thanks for your help.

  • Monday, March 26, 2012 6:58 PM
     
     
    Did you install SP1 and it's cumulative update?

    We are volunteers, if the reply help you mark it as your answer. thanks!!

    Blog: http://mohamedradwan.wordpress.com

     

  • Tuesday, March 27, 2012 6:48 AM
    Moderator
     
     

    Hi Ponnuru, 

    Thanks for your post.

    For the default Details tab, when you input the content in Steps to Reproduce field, after you click Save, the content which in Steps to Reproduce field will be recorded into History field, but the content in Steps to Reproduce field will not be cleared, unless you clear it manually.    

    If you want the field’s content be cleared automatically after you click the Save button, you need to create your custom work item control to achieve that.    


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

  • Tuesday, March 27, 2012 10:35 AM
     
     

    Hi John, we have created the custom control for the "Notes" field. Please find the screen shots of updating the comments in “Notes” to “NotesHistory” tab.

    Visual Studio Instance

    Once we add the comments in “Notes” field and click on save work item is updating the comments in NotesHistory and clearing the text of Notes field.

    vs instance

    web Instance

    Once we add the comments in “Notes” field and click on save work item is updating the comments in NotesHistory but which we are not able to see until we click on refresh. Is there a way to reload or refresh the page once we click on “Save”.

    web instance

  • Wednesday, March 28, 2012 6:42 AM
    Moderator
     
     

    Hi Ponnuru, 

    Thanks for your reply.

    I think it relate to that after you click Save in Web Access client side, it will loading the updates to server, but the Web Access client side can’t get updated data from server until Refresh the page, so it need Refresh(post back to server) the page to get the updates from server to client side.      

    Have you tried subscribe the After Save event to refresh your control? Like the following:

    this.m_workItemEditor.attachEvent("afterSave", Function.createDelegate(thisthis.onEditorAfterSave));

    this.m_workItemEditor.refresh();


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us


  • Thursday, March 29, 2012 11:54 AM
     
     

    Hi John,

    Thanks for your suggestion, i tried to write the above code in my custom control but not able to access "aftersave" event, could you please help me in how and where to implement the above mentioned code.

    Thanks,

    Subrahmanyam Ponnuru

  • Friday, March 30, 2012 9:08 AM
    Moderator
     
     

    Hi Ponnuru, 

    Thanks for your reply.

    You should define the this.m_workItemEditor.attachEvent("afterSave", Function.createDelegate(this, this.onEditorAfterSave)); code in your Web Access custom control .js file, please refer to the code snippet in a delayControl.js file(delayControl custom control):

    function delayControl(id,

                          workItemEditorObjectId,

                          fieldName,

                          controlId,

                          readOnly,

                          waitStates) {

        this.m_workItemEditorObjectId = workItemEditorObjectId;

        this.m_workItemEditor = null;

        this.m_fieldName = fieldName;

        this.m_controlId = controlId;

        this.m_readOnly = readOnly;

        this.m_control = null;

        this.m_waitStates = waitStates;

    }

    delayControl.prototype.init = functiondelayControl$init() {

        this.m_workItemEditor = $getObject(this.m_workItemEditorObjectId);

        this.m_workItemEditor.detachEvent("afterSave", Function.createDelegate(this, this.onEditorAfterSave));

        this.m_workItemEditor.attachEvent("afterSave", Function.createDelegate(this, this.onEditorAfterSave));

    }

    delayControl.prototype.onEditorAfterSave = functiondelayControl$onEditorAfterSave() {

        var_field = this.m_workItemEditor.getField("System.State");

        if(this.m_waitStates &&

        (this.m_waitStates.indexOf("*;", 0) >= 0 ||

        this.m_waitStates.indexOf(_field.Value + ";", 0) >= 0)) {

            window.setTimeout(Function.createDelegate(this, this.Refresh), 3000);

        }

    }

    delayControl.prototype.Refresh = functiondelayControl$Refresh() {

        if(this.m_workItemEditor) {

            this.m_workItemEditor.refresh();

        }

    }


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, March 30, 2012 1:17 PM
     
     

    Hi John,

    Thanks for helping me out in the issue.

    Acutally we are using TFS - 2010, we have developed our custom control using C# which is "dll" file and deployed on the web server for the Notes field. I have verfied in our web server for the delayControl.js but i am not able to find it. Could you please help me out in finding the path for delayControl.js and how to use it.

    Thank you,

    Subrahmanyam Ponnuru