Skip to content

调用put_table方法时,如果tdata数量量太大,想问下有没有分页功能或者其他示例分享? #470

Answered by yuzipeng05
yuzipeng05 asked this question in Q&A
Discussion options

You must be logged in to vote

暂时想到一种解决方法,供大家参考。

def set_page_input(data, page_num=3, current_page=0):
    remove('page_input')
    with use_scope('page_input'):
        put_table(data[current_page * page_num:(current_page + 1) * page_num])
        text_content = '共{}条数据,当前第{}页'.format(len(data), current_page + 1)
        next_page = current_page + 1
        previous_page = current_page - 1
        if current_page == 0:
            put_row(content=[put_text(text_content).style('float:right'),
                             put_button('下一页', lambda: set_page_input(data, current_page=next_page)).style('float:right')],
                size='25% 10%')
        elif current_page == len(data) // page_num:
            put_row(co…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yuzipeng05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant