locked
How to set focus on a sub-grid and on a section of a tab in Dynamic CRM2011 RRS feed

  • Question

  • Dear all,

    I can use setFocus() to set focus on a field on crm form.

    But I can use setFocus() on a sub-grid control

    Do you know how to set focus on a sub-grid or on a section of a tab in Dynamic CRM2011?

    Many thanks,


    If my question/answer can help you, please give me a points :) ----You may be disappointed if you fail, but you are doomed if you don't try---

    Thursday, December 27, 2012 8:34 AM

Answers

All replies

  • Hi,

    What you can't do? Put focus or obtain the reference to sub-grid?

    To set focus use the next code block:

    var control = Xrm.Page.ui.controls.get(“AttributeName”);
    control.setFocus();

    For get a reference for sub-grid you need rollup 2, check this: http://support.microsoft.com/kb/2466086 and use the code above:

    var control = Xrm.Page.ui.controls.get(“gridid”);
    Hope this helps.
    If i answered your question, please mark the response as an answer and also vote as helpful.

    Pedro Azevedo Crm Specialist 4.0\2011

    Thursday, December 27, 2012 10:04 AM
  • Hi there,

    Is there another way that I no" need rollup 2" ?


    If my question/answer can help you, please give me a points :) ----You may be disappointed if you fail, but you are doomed if you don't try---

    Thursday, December 27, 2012 10:37 AM
  • Hi,

    Try use this code:

    document.getElementById("GridName").control.refresh()
    Hope this helps.
    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    Thursday, December 27, 2012 11:00 AM
  • Hi,

    You can set focus to a subgrid as follows:

    document.getElementById(gridName).getElementsByTagName('a')[0].focus();

    Source:http://prodynamicscrm.com/articles/using-javascript-set-focus-subgrid-control


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    • Proposed as answer by Vikranth Pandiri Thursday, December 27, 2012 11:10 AM
    • Marked as answer by AnyMi Friday, December 28, 2012 4:08 AM
    Thursday, December 27, 2012 11:10 AM
  • Hi  vicky_smag

    I've try this.

    but I don't know why my sub-grid is scale down :(. It's smaller than normal

    • Edited by AnyMi Thursday, December 27, 2012 11:24 AM
    Thursday, December 27, 2012 11:23 AM
  • Hi,
       I don't think the script will scale down the subgrid size. I am not sure what is else is causing the issue. Is there any other script running on the subgrid?


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    Thursday, December 27, 2012 12:13 PM