web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Suggested answer

Difference between Grid().SelectCell() && focusController().focus()

(0) ShareShare
ReportReport
Posted on by

Hi all,

I am confused that the difference between Grid().SelectCell() && focusController().focus(), when I try to simulate a click action on the blank of a grid.

The usage of them is shown as below:

formName.Grid().SelectCell(formControlName);

formName.focusController().focus(formControlName);

For the first method, the definition and example are shown below:

pastedimage1669024722832v2.pngpastedimage1669024656566v1.png

For the second method, the definition and example are shown below:

pastedimage1669024946323v4.png

pastedimage1669024909034v3.png

My questions are:

1. What's the difference of these two methods? When should I use one instead of the other one?

2. Take form: InventQualityOrderTable for an example, if I want to simulate the action that just click the grid of field Warehouse (click the blank, instead of the hyperlink related to string "31"), how could I simulate it in an unit test case?

pastedimage1669007851028v1.png

Thanks in advance.

WR.

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: Difference between Grid().SelectCell() && focusController().focus()

    You can make use of the enter method on the form control. Still, it's a standard form you can make use of "onEnter" event handler. So onEnter events will be called whenever user clicks on that control.

    Thanks,

    Girish S.

  • Kai Cheng Profile Picture
    on at
    RE: Difference between Grid().SelectCell() && focusController().focus()

    Sry. Maybe my explanation is unclear.

    What I am going to do is to write a test case, and to simulate a click cell action on the form.

    Take invent Quality orders form for an example, I am trying to click the blank of cell "warehouse", but do not click the sting "31". Because if I click the "31", it will jump to the detail of warehouse 31.

    So for this scenario, what method should I use?

    Thanks in advance. Warm regards.

  • GirishS Profile Picture
    27,825 Moderator on at
    RE: Difference between Grid().SelectCell() && focusController().focus()

    Screenshot you are referring to is a standard code. Also, the method you are referring to is standard and you cannot override this method in your custom code.

    You have pasted the invent Quality orders form - Can you tell me the exact functionality you are trying to achieve in this from?

    Thanks,

    Girish S.

  • Kai Cheng Profile Picture
    on at
    RE: Difference between Grid().SelectCell() && focusController().focus()

    Hi, Girish,

    Thank you for your suggestion, I've updated the issue to make it clearer.

  • GirishS Profile Picture
    27,825 Moderator on at
    RE: Difference between Grid().SelectCell() && focusController().focus()

    Hi Kai Cheng,

    How you are using "formName.Grid().SelectCell(formControlName);" this line of code. I am not able to see such methods in X++ on form grid control.

    Can you elaborate your issue?

    Thanks,

    Girish S.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,105

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 215 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans