Skip to main content

Notifications

Announcements

No record found.

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

How to select multiple rows programmatically in Grid

(0) ShareShare
ReportReport
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,480 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,433 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans