You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When having a lot of rows in ag grid, rowSelected event will fires as many as the number of row when the select all checkbox is checked.
In this case, until all the rowSelected event finish, other event cannot be run. Is this the expected behaviour?
On some other more complex apps, the entire page is reload automatically and sometimes the websocket connection were lost.
I am using the code below:
import justpy as jp
import pandas as pd
import time
# wm_df = pd.read_csv('https://elimintz.github.io/women_majors.csv').round(2)
def row_selected4(self, msg):
print(msg.selected)
wp = msg.page
if msg.selected:
wp.selected_rows[msg.rowIndex] = msg.data
else:
wp.selected_rows.pop(msg.rowIndex)
s = f'Selected rows {sorted(list(wp.selected_rows.keys()))}'
for i in sorted(wp.selected_rows):
s = f'{s}\n Row {i} Data: {wp.selected_rows[i]}'
if wp.selected_rows:
wp.rows_div.text = s
else:
wp.rows_div.text = 'No row selected'
def grid_test13():
wp = jp.QuasarPage()
wp.selected_rows = {} # Dictionary holding selected rows
list1 = []
for i in range(1000):
list1.append({'No.':f'{i}', 'Column Name':f'Column Name {i}'})
df = pd.DataFrame(list1)
grid = jp.AgGrid(a=wp, style='height: 200px; width: 300px; margin: 0.25em')
grid.load_pandas_frame(df)
grid.options.columnDefs[0].checkboxSelection = True
grid.options.defaultColDef.filter = True
grid.options.defaultColDef.sortable = True
grid.options.rowSelection = 'multiple'
grid.options.columnDefs[0].checkboxSelection = True
grid.options.columnDefs[0].headerCheckboxSelection = True
grid.options.columnDefs[0].headerCheckboxSelectionFilteredOnly = True
grid.on('rowSelected', row_selected4)
def btn_event2(self, msg):
btn1.loading = not btn1.loading
btn1 = jp.QBtn(loading=False, flat=True, label='Download', color='primary', a=wp)
btn2 = jp.QBtn(loading=False, flat=True, label='Toogle Loding', color='primary', a=wp)
btn2.btn1 = btn1
btn2.on('click', btn_event2)
wp.rows_div = jp.Pre(text='Data will go here when you select rows', classes='border text-lg', a=wp)
return wp
jp.justpy(grid_test13)
I am thinking of using async/await function but I am not sure which part should be awaited.
Btw, I believe this is a JustPy only related matter so I did not post it to stackoverflow or anywhere else.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
When having a lot of rows in ag grid, rowSelected event will fires as many as the number of row when the select all checkbox is checked.
In this case, until all the rowSelected event finish, other event cannot be run. Is this the expected behaviour?
On some other more complex apps, the entire page is reload automatically and sometimes the websocket connection were lost.
I am using the code below:
I am thinking of using async/await function but I am not sure which part should be awaited.
Btw, I believe this is a JustPy only related matter so I did not post it to stackoverflow or anywhere else.
Beta Was this translation helpful? Give feedback.
All reactions