Skip to content

Commit

Permalink
handle dynamic value for selected (#1610)
Browse files Browse the repository at this point in the history
resolves #1609

Co-authored-by: Fred Lefévère-Laoide <[email protected]>
  • Loading branch information
FredLL-Avaiga and Fred Lefévère-Laoide authored Jul 30, 2024
1 parent d4e36ae commit eee7269
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions taipy/gui/_renderers/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ def _set_chart_selected(self, max=0):
sel = []

def _get_list_attribute(self, name: str, list_type: PropertyType):
varname = self.__hashes.get(name)
if varname is None:
hash_name = self.__hashes.get(name)
if hash_name is None:
list_val = self.__attributes.get(name)
if isinstance(list_val, str):
list_val = list(list_val.split(";"))
Expand All @@ -680,7 +680,8 @@ def _get_list_attribute(self, name: str, list_type: PropertyType):
list_val = []
self.__set_react_attribute(_to_camel_case(name), list_val)
else:
self.__set_react_attribute(_to_camel_case(name), varname)
self.__set_react_attribute(_to_camel_case(name), hash_name)
self.__update_vars.append(f"{_to_camel_case(name)}={hash_name}")
return self

def __set_class_names(self):
Expand Down
2 changes: 1 addition & 1 deletion taipy/gui/_renderers/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ class _Factory:
)
.set_value_and_default(with_default=False, var_type=PropertyType.data)
._get_dataframe_attributes()
._get_list_attribute("selected", PropertyType.number)
.set_attributes(
[
("page_size", PropertyType.number, "100"),
Expand All @@ -524,7 +525,6 @@ class _Factory:
]
)
._set_propagate()
._get_list_attribute("selected", PropertyType.number)
._set_table_pagesize_options(),
"text": lambda gui, control_type, attrs: _Builder(
gui=gui,
Expand Down
2 changes: 1 addition & 1 deletion taipy/gui/viselements.json
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@
},
{
"name": "selected",
"type": "list[int]|str",
"type": "dynamic(list[int]|str)",
"doc": "The list of the indices of the rows to be displayed as selected."
},
{
Expand Down

0 comments on commit eee7269

Please sign in to comment.