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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Grid Column number

(0) ShareShare
ReportReport
Posted on by 290

I have a Grid dynamically. The rows and columns are added, whose labels are dynamically modified in the creation.

Is there any way of knowing the column number from a particular cell in a Grid? Or the column name? According to the cell I am positioned.

Example. Do I have a way of knowing I am in the position Row 3 Column 4 of a Grid?

With the DS I can get the row number but I can't still get column number.

Thanks.

 

 

*This post is locked for comments

I have the same question (0)
  • Sebastián Tirelli Profile Picture
    290 on at

    I have found that using the this.dataField in all my control events I can get the column table field name.

    info(strfmt("%1", fieldid2name(tablenum(Table), this.dataField())));

    If someone has another idea, please share.

  • Verified answer
    Luegisdorf Profile Picture
    1,930 on at

    You can retrieve the current control with element.selectedControl(). "Element" is the formRun handle.

  • Sebastián Tirelli Profile Picture
    290 on at

    Check the event selectControl in the form. You get as a parameter the FormControl.

    For my need I just pass the control to a global variable and then use that with a button.

    Something like this.

    public boolean selectControl(FormControl _control)
    {
        boolean ret;
        ;
        ret = super(_control);

        if(ret)
        {
            if(_control)
            {
                if(Grid.contains(_control))
                {
                    formControlId= _control.id();
                }
            }
        }

        return ret;
    }

    So I make sure its a control inside my Grid.

    Then with the Id retrieved I can use formControl = element.control(formControlId); in any other place.

    Thanks a lot.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans