List within list, how to refresh inner list data

Hello,

Here is my scenario, I got a list of products and each product have 0 to 3 photos. I would like to show the product in list with images at the bottom of list item content.

I've two action to get local DB data, first one to get the products and second one to get the images by product's ID.

I put the product list in a list widget for product list data Source. And put images action in a Gallery list inside that list item's content for images list data Source and display 3 images in a row.

But i can not get the images gallery show the images. It seems to not get the correct getAllProducts.List.Current.product.Id by iterated list item.

And the getImagesByProductID action has filter with the productList.Current.product.Id equal the the foreign key productId in image table.

I've test the the get image list action in other action and it respond correct records.

Does the list do iteration in the rendering process?

Or i'm not in the correct way to display "2D arrya" data in the list widget?

LouisT wrote:

Hello,

Here is my scenario, I got a list of products and each product have 0 to 3 photos. I would like to show the product in list with images at the bottom of list item content.

I've two action to get local DB data, first one to get the products and second one to get the images by product's ID.

I put the product list in a list widget for product list data Source. And put images action in a Gallery list inside that list item's content for images list data Source and display 3 images in a row.

But i can not get the images gallery show the images. It seems to not get the correct getAllProducts.List.Current.product.Id by iterated list item.

And the getImagesByProductID action has filter with the productList.Current.product.Id equal the the foreign key productId in image table.

I've test the the get image list action in other action and it respond correct records.

Does the list do iteration in the rendering process?

Or i'm not in the correct way to display "2D arrya" data in the list widget?

Hi LouisT,

A quick suggestion , why don't you create a web block to show the images . shift all your image logic to web block and just pass the product id to that .so once when you are making any change all you need to do is to call ajax refresh .


Hi Louis,

Did you debug at all? Check what the value is that's passed to the Gallery? Checked the output of the query you use to fetch the images? If you're stuck it's ok to ask a question here, but please, make sure you've done everything possible to find out yourself.

LouisT wrote:

Hello,

Here is my scenario, I got a list of products and each product have 0 to 3 photos. I would like to show the product in list with images at the bottom of list item content.

I've two action to get local DB data, first one to get the products and second one to get the images by product's ID.

I put the product list in a list widget for product list data Source. And put images action in a Gallery list inside that list item's content for images list data Source and display 3 images in a row.

But i can not get the images gallery show the images. It seems to not get the correct getAllProducts.List.Current.product.Id by iterated list item.

And the getImagesByProductID action has filter with the productList.Current.product.Id equal the the foreign key productId in image table.

I've test the the get image list action in other action and it respond correct records.

Does the list do iteration in the rendering process?

Or i'm not in the correct way to display "2D arrya" data in the list widget?

Hi LouisT!


I agree with Pranav. you can use a webblock with a productId as input variable, passing getAllProducts.List.Current.product.Id current table identifier. This webblock will serves to show images from your 2nd action (getimagesfromproducts that has been filtered by ProductId. 

Maybe the problem is that image content wasn't saved correctly(having 0 bytes) or in your images list you aren't using na image from database to populate your image on screen.

I hope it will helps you.

Thanks and Best Regards,

Nuno Pereira


Hello All,

Thank you for your help.

I'm developing an application for mobile platform. Web block may not help my scenario.

I feel like List within List is not work.

1. The Fetch Data From Local Storage action always stay at index 0 of the source list. Even triggered the Refresh Data.

e.g: filter with, productImage.productId = productList.Current.Id , always get the first product from productList.

But it can return the correct data set if use the "Aggregate" item with exact filtering criteria in the same action.

2. No Event trigger for List Item on Render, on Ready or any events that I can link an action to get and set the temporarily image list for current list item. Then I test above action by "On Click" event of the list item.

Although it can get the correct images list from the "Aggregate" in action, but all List Item bound to a single local variable cause it to re-render all List Item with same image list. And 

3. I've try to limited the number of image for each product to 3 images. Unfortunately each local database can only allow one Binary Data type attribute. Therefor i've store images in separate table.


That is all my debug informations and not much progress to solve the List within List in mobile platform.

The most confusing thing is the List.Current value in "Fetch Data From Local Storage" action is not update with the List Item change.

Solution

Hi LouisT,

You can refer below Implementation Guide for same.


#Data:

You can get from Aggregate's, one for Product & another for ProductsImages.
or
You can create actions:
 1- GetProducts: Return a List of All Products
 2- GetProductImagesByID : Return a List of Images [URL / Binary]



#Design:
- ProductList on Screen containing ProductListItem & ProductListItem Containing a BLOCK which will be used to design ProductImagesSection under each ListItem.
- ProductImages Block: Will have an input variable as InputProductID, thus while using block on ProductListItem we will pass the List.Current.ProductID to it. So that while the List gets Iterated the block will get a new ID.

#Note:
- Remember to add onParametersChanged Event Action in Block & under this Action, you should recall the DataAction or Refresh the Aggregate whichever method you use to get Data.

- Using Aggregates for MainProductList & ProductImages under Block will be feasible instead of using Actions to get Data.

Hope it helps,
Thanks
Assif



Solution