Grid-Add Row Rendering

I'm trying to fill a gridadd table with teams using RowRendering to allow team entry. This worked in v2023, but v2026 only partially fills the grid, and displays incorrect category values, using this code:

if(isset($this->RowIndex)) {

$grid_num = $this->RowIndex;
if(($grid_count >= $grid_num) && is_int($grid_num) && ($grid_num >= 1)) {
    $offseter = $grid_num - 1;
    if (Get("competition_type") == 0) {
    //get & set product details
        $team = ExecuteRow("SELECT a.team_id,a.category_id FROM team a
                 WHERE a.club_id = " . CurrentUserInfo("club_id") . "
                 ORDER BY a.category_do ASC, a.team limit 1 
                 OFFSET $offseter");
} 
if (Get("competition_type") == 0 && $team) {
    $this->team_id->CurrentValue = $team["team_id"];
    $this->category_id->CurrentValue = $team["category_id"];
  var_dump($this->team_id->CurrentValue,$this->category_id- >CurrentValue,$grid_num);
}

if (Get("competition_type") == 1 && ($category)) $this->category_id->CurrentValue = $category["category_id"];

}


The var-dump shows team_id, category_id, and grid_num as i would expect, but in my example there are 4 teams, 4 rows are displayed, but only 2 filled in, and category is displayed incorrectly. What's changed since the 2023 version?

Your posted code may be incomplete. If it is complete, double check the follows:

  1. Your code relies on Get("competition_type"), unless you added that yourself, otherwise there is no such URL parameter, then Get("competition_type") == 1 will not meet.
  2. There is no $category in the context your shown.
  3. If you try to pre-set values, setting values to CurrentValue may not work, during Add/Edit your should use EditValue if the field is not lookup fields.
  4. Using Row_Rendering may not work because the event is fired before rendering. After rendering by built-in code, some values may be set (and overwrite your value). Usually you may want to use Row_Rendered server event instead.
  5. Since you use CurrentUserInfo("club_id"), it will not work for super admin. Better check if the value is not empty first.

Thanks for your reply, the problem lay elsewhere and was caused by faulty lookupselecting logic. It's working now, even though VScode intelliphense warns me Undefined property '$RowIndex'. It took me a long time to resolve and i'm not entirely convinced this is now the best, future-proofed method to prepopulate data in a gridadd. I'll investigate further when i have time and post my results. Other thoughts appreciated.