From fbbd317d999ff5e943591b42a56e2001d46cba76 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Fri, 12 Jun 2026 23:23:27 +0200 Subject: [PATCH] added prepend_row_id --- stand/aggridx.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stand/aggridx.py b/stand/aggridx.py index d921e01..575f8d6 100644 --- a/stand/aggridx.py +++ b/stand/aggridx.py @@ -39,7 +39,7 @@ class aggridx(ui.aggrid): this operation maintains the current view on the data """ row_index = self.row_id_to_index(row_id) - row = {self.index: row_id, **row} # setdefault would not force index to be the first column + row = self.prepend_row_id(row_id, row) self.ensure_column_defs(row) self.set_row_data(row, row_index) @@ -50,7 +50,7 @@ class aggridx(ui.aggrid): this operation maintains the current view on the data """ row_index = self.row_id_to_index(row_id) - row = {self.index: row_id, **row} # setdefault would not force index to be the first column + row = self.prepend_row_id(row_id, row) self.ensure_column_defs(row) self.update_row_data(row, row_index) @@ -60,7 +60,7 @@ class aggridx(ui.aggrid): append any missing columns on the right side of the table this operation maintains the current view on the data """ - row = {self.index: row_id, **row} # setdefault would not force index to be the first column + row = self.prepend_row_id(row_id, row) self.ensure_column_defs(row) self.extend_row_data([row]) @@ -84,6 +84,10 @@ class aggridx(ui.aggrid): # self.insert_row_data([row], index) + def prepend_row_id(self, row_id, row): + return {self.index: row_id, **row} # setdefault would not force index to be the first column + + def ensure_column_defs(self, columns): """ append any missing columns on the right side of the table