how to use V-bind or :rows for q-table #313
Answered
by
elimintz
YohannesGetu
asked this question in
Q&A
-
I want to use v-bind for creating a q-table for columns and rows. please help me for example :
|
Beta Was this translation helpful? Give feedback.
Answered by
elimintz
Oct 19, 2021
Replies: 1 comment 1 reply
-
Here is an example of a QTable that updates every 3 seconds: import justpy as jp
import asyncio
columns = [{'field': 'first', 'label': 'First Col'}, {'field': 'second', 'label': 'Second Col'}, {'field': 'third', 'label': 'Third Col'}, ]
data = [{'first': 1, 'second': 2, 'third': 3}]
wp = jp.QuasarPage(delete_flag=False)
d = jp.Div(classes='q-pa-md', a=wp, style='height: 800px')
table = jp.QTable(title='Update Example', data=data, columns=columns, a=d, dense=True, pagination={'rowsPerPage': 10})
counter = 1
async def table_counter():
global counter
while True:
print(counter)
counter += 1
table.data[0]['first'] = counter
table.data.append({'first': 1*counter, 'second': 2*counter, 'third': 3*counter})
jp.run_task(wp.update())
await asyncio.sleep(3)
async def table_init():
jp.run_task(table_counter())
def table_test():
return wp
jp.justpy(table_test, startup=table_init) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
YohannesGetu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is an example of a QTable that updates every 3 seconds: