Fixed bug where same DataGridQuery for all grids
This commit is contained in:
@@ -161,7 +161,8 @@ class DataGrid(MultipleInstance):
|
||||
return None
|
||||
|
||||
for col_id, values in self._state.filtered.items():
|
||||
if col_id == FILTER_INPUT_CID and values is not None:
|
||||
if col_id == FILTER_INPUT_CID:
|
||||
if values is not None:
|
||||
if self._datagrid_filter.get_query_type() == DG_QUERY_FILTER:
|
||||
visible_columns = [c.col_id for c in self._state.columns if c.visible and c.col_id in df.columns]
|
||||
df = df[df[visible_columns].map(lambda x: values.lower() in str(x).lower()).any(axis=1)]
|
||||
@@ -528,13 +529,13 @@ class DataGrid(MultipleInstance):
|
||||
selected = []
|
||||
|
||||
if self._state.selection.selected:
|
||||
#selected.append(("cell", self._get_element_id_from_pos("cell", self._state.selection.selected)))
|
||||
# selected.append(("cell", self._get_element_id_from_pos("cell", self._state.selection.selected)))
|
||||
selected.append(("focus", self._get_element_id_from_pos("cell", self._state.selection.selected)))
|
||||
|
||||
return Div(
|
||||
*[Div(selection_type=s_type, element_id=f"{elt_id}") for s_type, elt_id in selected],
|
||||
id=f"tsm_{self._id}",
|
||||
#selection_mode=f"{self._state.selection.selection_mode}",
|
||||
# selection_mode=f"{self._state.selection.selection_mode}",
|
||||
selection_mode=f"column",
|
||||
**extra_attr,
|
||||
)
|
||||
|
||||
@@ -57,7 +57,7 @@ class Commands(BaseCommands):
|
||||
|
||||
class DataGridQuery(MultipleInstance):
|
||||
def __init__(self, parent, _id=None):
|
||||
super().__init__(parent, _id=_id or "-query")
|
||||
super().__init__(parent, _id=_id)
|
||||
self.commands = Commands(self)
|
||||
self._state = DataGridFilterState(self)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user