Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Unanswered

How to select multiple rows programmatically in Grid

Posted on by
I want to select a number of rows in a grid programmatically applying some conditions. The rows supposed to be pre-selected. However, I can't find any method to perform this operation. Here is my function as follows.
 
function formatZIPCodeDecimalFromSubgridField1(executionContext) {    var formContext = executionContext.getFormContext();    debugger;    var tabName = /tab_Settings/;    var tabControl = formContext.ui.tabs.get(tabName);    if (tabControl.getVisible()) {              var subgridControl = tabControl.sections.get(/tab_4_section_3/).controls.get(/Subgrid_new_2/);        subgridControl.refresh();        setTimeout(function () {                      var selectedRecords = subgridControl.getGrid().getRows();            selectedRecords.forEach(function (record) {                var fieldName = /code/;                var fieldValue = record.getData().getEntity().attributes.get(fieldName).getValue();                if (fieldValue !== null) {var rowId = record.getData().getEntity().getId();//subgridControl.SelectRow(1);                    //subgridControl.getGrid().setSelection(rowId, true);                                   }            });        }, 1000);    }}
 
  • Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
    How to select multiple rows programmatically in Grid
    Hi,

    Why you want to pre-select the rows because if you are writing the javascript then you can get those records using retrieve multiple API call.

    Also, we do not have any method currently to select.

    if you want the functionality then you can try the PCF control. but this will be time consuming.
  • Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    How to select multiple rows programmatically in Grid
    Hi Partner,
    Do you mean that such a tick action is implemented via js code?
    Based on current documentation, there is currently no method to achieve this.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans