web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Editable grid getRows(...
Power Apps
Unanswered

Editable grid getRows() method returns always an empty collection

(0) ShareShare
ReportReport
Posted on by 8

I have following Editable grid with 3 records: 

OsmanEsen_1-1661963454472.png

 



Using following code in JS, the getRows() always returns an empty collection. 
But when I use the getTotalRecordCount() method instead, it is able to return the value "3". 

OsmanEsen_2-1661963490188.png


It is unclear for me, why getRows() always return an empty collection ?. 

 

The code: 
function loadValue(executionContext) {

var formContext = executionContext.getFormContext();
var gridContext = formContext.getControl("nf_royalty_template_grid");
var gridOC = gridContext.getGrid();
var totalGridRows = gridOC.getTotalRecordCount();
var allRows = gridOC.getRows();

allRows.forEach(function (row, i) {
var gridColumns = row.data.entity.attributes;
gridColumns.forEach(function (column, j) {
var atrName = column.getName();
var atrValue = column.getValue();
console.log(atrName+":"+atrValue);
});

});

}

Debugging in JS

OsmanEsen_0-1661963345978.png



Categories:
I have the same question (0)
  • SBax Profile Picture
    1,348 on at

    Can you replace the bold text with

     

    var allRows = gridContext.getGrid().getRows() 

     

    I'd like to see what is held in allRows if we do it this way

  • Osman Esen Profile Picture
    8 on at

    Thanks for the reply @SBax . It stills returns an empty array: 

    OsmanEsen_0-1661967196722.png

    I have done a refresh() to the grid when loading the form, and invoking this piece of code "loadValue()" method when I manually change a field. I read somewhere that there might be a bug with getRows() method since it will always return an empty array if the refresh() method has been invoked on it. 

  • Osman Esen Profile Picture
    8 on at

    @SBax that was the issue. I have commented out the refresh() in form onLoad and it is now able to fetch all 3 records: 

    OsmanEsen_0-1661968308823.png


    This seems like a bug

  • SBax Profile Picture
    1,348 on at

    By the sounds of it, your get rows is trying to get them before the refresh is complete.

     

    I would suggest converting your refresh function to return a promise then use a . then to get your rows post refresh completing 

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard