Alternate row colors & add timestamp on check event

Hello,

One approach I use to alternate the color of rows in a repeating panel is as follows:

# in init
self.color_rows(self.repeating_panel_1)

def color_rows(self, rep):
  for i, r in enumerate(rep.get_components()):
    if not i%2:
      r.background='theme:Gray 200'

This function goes in the form which holds your repeating panel. See the discussion here for more
details.

Please see the documentation on events here. You will want to use the datetime module to send a timestamp to your DataTables whenever the check event is triggered.

In the to-do tutorial you referenced, the author sets up a button click event that sends data to the DataTable. This is very similar to what you are attempting in terms of handling the event.

The timestamp can be returned as follows from the datetime module:

import datetime

datetime.datetime.now() # returns current date and time

Let us know how this goes and please share a code example if anything is unclear with these suggestions.

1 Like