Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / FormCheckboxControl.ch...
Finance forum
Suggested answer

FormCheckboxControl.checked(true) is not reflected on UI

Posted on by 25
All i want is to check the checkboxControl that i have (MarkedControl) but nothing works and uncheck when i click unselect all button
 
-----------------------------------------
class SelectAllButton
{
    public void clicked()
    {
        MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();
        super();
        selectionHelper.parmDataSource(ModuleTable_ds);
        ModuleTable  = selectionHelper.getFirst();
        if (ModuleTable.RecId)
        {
            while (EX_ModuleTable)
            {
                info(strFmt("Selected record is %1", EX_ModuleTable.Module));
                Info(int2Str(MarkedControl.value()));
                MarkedControl.checked(true);
                EX_ModuleTable = selectionHelper.getNext();
            }
        }
    }
}
--------------------------------------------------
class ClearAllButton
{
    public void clicked()
    {
        super();
        while (ModuleTable)
        {
            Info(int2Str(MarkedControl.value()));
            MarkedControl.checked(false);
        }
    }
}

 
 
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 3,434 on at
    FormCheckboxControl.checked(true) is not reflected on UI
    Hi,
     
    Check the following blog on How to use edit methods to mark records:
     
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Waed Ayyad Profile Picture
    Waed Ayyad 3,434 on at
    FormCheckboxControl.checked(true) is not reflected on UI
    Hi,
     
    What is the usage of mark checkbox control?
     
     
    Thanks,
    Waed Ayyad
  • Suggested answer
    Anton Venter Profile Picture
    Anton Venter 6,730 Super User on at
    FormCheckboxControl.checked(true) is not reflected on UI
    The basic idea is to bind your checkbox form control (dataMethod property) to an edit method on the form. The edit method uses a Map (with form scope) to store and retrieve the Marked values for each row in the grid. The map is used as form record cache. In the set part of the edit method, you set the current value of the Marked field using the key of the current record. In the get part, you retrieve the Marked value using the key from the Map.
     
    The code below is untested and certainly not a complete edit method but it demonstrates the basic idea of what you should do.
     
    	NoYes ret;
    
    	if (_set)
    	{
    		mMapMarked.insert(_table.RecID, _marked);
    	}
    	else
    	{
    		if (mMapMarked.exists(_table.RecID))
    		{
    			ret = mMapMarked.lookup(table.RecID);
    		}
    	}
    
    	return ret;
    
     
  • Roy Saliba Profile Picture
    Roy Saliba 25 on at
    FormCheckboxControl.checked(true) is not reflected on UI
    But in the forms provided by Microsoft, there's a lot of functions inside each others, and it is too complicated, my idea is simpler than that, anyways thank you!
  • Roy Saliba Profile Picture
    Roy Saliba 25 on at
    FormCheckboxControl.checked(true) is not reflected on UI
    Okay thank you
  • Suggested answer
    Anton Venter Profile Picture
    Anton Venter 6,730 Super User on at
    FormCheckboxControl.checked(true) is not reflected on UI
    Have a look at one of the standard forms like settling customer invoices to see how it's done.
  • Roy Saliba Profile Picture
    Roy Saliba 25 on at
    FormCheckboxControl.checked(true) is not reflected on UI
    Thank you for your reply Anton,
    The mark column is checkbox column and is not related to the datasource it is on the form level
     
    -----------------------------------------
    class SelectAllButton
    {
        public void clicked()
        {
            MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();
            super();
            selectionHelper.parmDataSource(ModuleTable_ds);
            ModuleTable  = selectionHelper.getFirst();
            if (ModuleTable.RecId)
            {
                while (EX_ModuleTable)
                {
                    info(strFmt("Selected record is %1", EX_ModuleTable.Module));
                    Info(int2Str(MarkedControl.value()));
                    MarkedControl.checked(true);
                    EX_ModuleTable = selectionHelper.getNext();
                }
            }
        }
    }
    --------------------------------------------------
    class ClearAllButton
    {
        public void clicked()
        {
            super();
            while (ModuleTable)
            {
                Info(int2Str(MarkedControl.value()));
                MarkedControl.checked(false);
            }
        }
    }
     
  • Anton Venter Profile Picture
    Anton Venter 6,730 Super User on at
    FormCheckboxControl.checked(true) is not reflected on UI
    Can you give us more information about the form? How is the Mark column bound? There is probably an edit method with a collection object in the form. So you will have to use that object to "mark" each row. By the way, please format your code by using Insert Code Snippet, it makes the code easier to read.

Helpful resources

Quick Links

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Blog subscriptions now enabled!

Follow your favorite blogs

TechTalk: How Dataverse and Microsoft Fabric powers ...

Explore the latest advancements in data export and integration within ...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 284,877 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,425 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans