Set and get functions for page on repeating_panel

Hi All,

I’ve read the docs, and just spent about an hour searching the forums and I can’t quite find what I’m looking for. ChatGPT isn’t really any help either, so I’m coming to the experts :smiley:

What I’m trying to do:
I have a repeating_panel with 400 rows, but only show 50 rows at a time to the user, with the navigation arrows at the bottom so that they can navigate the pages.

The user is able to edit a row, and write those changes to the database (this all works nicely)
However when I refresh the repeating_panel, the user is presented with the first page again, and will have to use the navigation to find their amended row.

I am trying to find a way that I can get my app to “Remember” which page in the repeating_panel the user was on, so that when the page is refreshed, the repeating_panel moves automatically to that page, and preferable that row is presented in the middle of the screen…I’ll settle for just that page though.

If I can access the “page number” attribute or something like that, then perhaps I could write a set/get function pair to meet my requirements.

What I’ve tried and what’s not working:
Reading all the docs
Reading the forums posts
ChatGPT - tells me to use repeating_panel.selected_index, which doesn’t exist as far as I can see

Anyone got any ideas?
Thanks in advance

That gives you the data grid functions. You’ll have to remember the current page yourself.

1 Like

@jshaffstall thank you very very much for this. I’ll give it a go and let you know how I get on.

What do you mean by “refresh”?

Hi stefano - I mean reload the page, which rereads the table, which then reloads the repeating_panel.items().
however, the fix works. I’ll put that in a different reply.

Yes, this works.

In the form that holds the datagrid and repeating_panel, I added

def __init__(self, grid_page=0, **properties):
    self.grid_page=grid_page   

I use a dropdown to populate the repeating_panel items

def my_drp_change(self,grid_page=0, **event_args):
    self.data_grid_1.set_page(self.grid_page)

My repeating panel rows have an edit button in them, so I want the displayed repeating_panel to remember where it was when I edited a row…so I did the following:
Then in the RowTemplate form,

   grid=self.parent.parent
   mypage=grid.get_page()
   open_form('myDash',grid_page=mypage)

Hope that helps others. If it isn’t very well explained, then I can try and rewrite it.
Cheers

(finally found the correct quotation marks to highlight python code)

1 Like