added prepend_row_id
This commit is contained in:
+7
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user