Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

How to Enable\Disable Perticular Column in Grid ??

Posted on by 1,010

I want to set Enable/Disable one field of particular row

Like

                     Home        Phone         Travel

              1.    Value11    Value12     Value 13

              2.    Value21    Value22     Value 23

              3.    Value31    Value32     Value 33

              4.    Value41    Value42     Value 43

For example i want to disable Value33 of Row3. for this I write following code in Active method of DataSource.

if(LISPL_ProjectContractTable.Travel== NoYes::No )
{
LISPL_ProjectContractTable_ds.object(fieldNum(LISPL_ProjectContractTable,Travel)).enabled(false);

}

but whenever  i am writing value on one Column it is copying the same value to all column of row.

Kindly Do Help..

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 228,112 Most Valuable Professional on at
    RE: How to Enable\Disable Perticular Column in Grid ??

    You can't do it for individual cells. Please read my reply again.

    If your active() method isn't called, you're probably working with a wrong datasource.

  • D.K.S. Profile Picture
    D.K.S. 1,010 on at
    RE: How to Enable\Disable Perticular Column in Grid ??

    Hi Andre, I did the same you told. I kept break point and debugged but active method is not calling on Row Change in Grid.

    how do i can achieve my goal to Enable/Disable Grid of Perticular Cell. ??

  • D.K.S. Profile Picture
    D.K.S. 1,010 on at
    RE: How to Enable\Disable Perticular Column in Grid ??

    Hello Martin,

    So How can i do it for Perticular Cell ? Kindly help.

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 228,112 Most Valuable Professional on at
    RE: How to Enable\Disable Perticular Column in Grid ??

    Of course - it's a property of the column, not of an individual cell. But that's all right, because if users switches to another row, activate() executes again and set the value appropriately based on data in the active row. What's the value of Enabled property for inactive rows is irrelevant, because users can't work with them.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,263 Super User 2024 Season 2 on at
    RE: How to Enable\Disable Perticular Column in Grid ??

    Hi D.K.S,

    The coding is disabling the complete column. You should also have an option to re-enable the field for other records.

    So also add:

    else

    {

    LISPL_ProjectContractTable_ds.object(fieldNum(LISPL_ProjectContractTable,Travel)).enabled(true);

    }

    Or replace the complete logic with:

    LISPL_ProjectContractTable_ds.object(fieldNum(LISPL_ProjectContractTable,Travel)).enabled(LISPL_ProjectContractTable.Travel== NoYes::Yes);

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,263 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,112 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans