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 :
Finance | Project Operations, Human Resources, ...
Answered

Which datasource method should be used if a user click on already selected record in grid

(0) ShareShare
ReportReport
Posted on by 240

Hi all,

I have a form with multiple datasources in different grids. I am implementing a logic that if a user selects the record in one grid, it should filter the records in another based on the value of a filter control.

I have used the selectionChanged() method for that purpose, so when form open user set the value in filter control and then select any record in the grid, the filter applies in another datasource. but the problem with selectionChanged() method is that they only get called when the user selects a new record. So if I open a form and my datasource has only one record in it, I set the value in filter conrol and then select that one record of the datasource which is already selected, the method wouldn't get called. I have tried with active() method too, it also has the same behaviour.

Can anybody suggest which datasource method should I use when the user selects the already selected record in the form grid?

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Active is the correct method. My suggestion is to filter the second data source also when the filter is changed, not only when user selects a record on the grid. But this comment is based on limited information.

    Anyway, you can hook in clicked method of the grid, there should be some method that is fired when anything on the grid is clicked. Then get the current record of the data source and you're good to go. But this UX behavior is not used anywhere in the standard system. My recommendation is to align with the logic of the standard system. Filtering something when the filter is modified would seem logical to me, instead of having to click the already selected record in order to trigger the filtering.

    And of course if user selects another record you must filter again.

  • Hassan Akhtar Khan Profile Picture
    240 on at

    Actually the filter is applied on the selected record value and that filter control I am talking about will just determine that filter should be applied or not. Lets say it is a check box, on selection changed event it will first checks if the check box is checked and then it will apply filter on second datasource based on the some field value in selected datasource.

    So problem will occur if user select the check box to apply filter and then select a record in the first datasource but there is only one record which is already selected, selectionChanged could not be called.

    I have currenlty moved my code in active method, so that user could at least refresh the form after check box is selected. The active method will be called on refreshing the datasource and the filter would be applied.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Just add code in the modified method of the checkbox and apply the filter there, and from the active method of the data source. This way if filter is checked, data is filtered based on the selected method of the data source. This way your user doesn't need to click the record which is already selected to actually get the filtered results. One click less and much more intuitive.

    If user selects another record, filtering will run again. And if user clears the checkbox, your code should clear the filter.

    Makes sense?

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans