I want to display a datagrid with different images uploaded by the user, every time he/she uses the app. I’m able to store a new image in a new row in the Data Table. But when I try to display it in the DataGrid, the recent uploaded image appears in every row, even in the place of old images. I can see the old images in the data table but I am not able to display it with the new image in the datagrid. Please help.
Thanks!
Are you able to share a clone link of your app so that we can see the specifics?
Click the icon in the IDE, then “Share App”, then follow those instructions.
Here’s the link.
https://anvil.works/build#clone:M44EEOPWY45JO2IZ=LYWQDMVOLSYLWQUBXIRY5GN3
Form1 has a link named ‘CHECKUP HISTORY’ that connects to Form3. I am trying to display the DataTable table2 in Form3. I cant find a way to search for images for each row separately (image1.source in RowTemplate1)
I get an index error but you seem to be describing an error-free app that is just not doing what you expect.
Let me know if you are trying to understand the index error, or if there is another issue that can be seen without additional debugging (and share that clone link).
I think this will help explain my query
If I simply search my datatable, it displays <anvil.LazyMedia object> and not the image in the data grid
https://anvil.works/build#clone:DKZHJTMQ27QQOPQQ=A7MFUQV4R45S5Z2FBL5HT7OW
If I tweek my code a bit, then the most recent image is appearing in every row, replacing the previously uploaded images
https://anvil.works/build#clone:J7H6KS6372NEIC3Z=6X4E5HWA7F3GXTUMKH272IDQ
You appear to be storing the image as a global variable in your code, rather than using the database! You store the image in Module1.pic
as it gets uploaded, and then in RowTemplate
you do:
self.image_1.source=Module1.pic
…which of course shows the same image for every row in the table!
If you write the following line of code instead, each row in the table will display the Image
from its row of the database:
self.image_1.source=self.item['Image']
This worked perfectly fine! Thanks a ton!