Page 1 of 1

How to simulate buying a product?

Posted: Fri Jul 18, 2014 12:23 pm
by Anil Sagar

I am trying to create a mock app for buying a product. Pls see the snapshot below. There are 2 products shown. Each is stored in an appery collection as an array (in a column) with various attributes like product description, price, image etc.

Page uses a grid and shows a buy button for each product.

Now my problem is how to associate a particular button to a particular product. That is - if I press top button then I should be able to buy the top product.

So how to make sure that pressing the first button initiates actions for the first product in the array? Pressing 2nd button should lead to action on the second product in the array? Image


How to simulate buying a product?

Posted: Fri Jul 18, 2014 1:19 pm
by Evgene Karachevtsev

Hello Anil,

Please clarify do you get all these descriptions of products and buttons via mapping?
In General steps are:
If you add js code on click on the button, in this code this variable this will indicate to the button the user clicked. In the js code, you will be able to find in what container is this button. In this container you will be able to find hidden label with product id
This will help http://api.jquery.com/category/traver...


How to simulate buying a product?

Posted: Sat Jul 19, 2014 10:06 am
by Anil Sagar

Hi Evgene, yes I am getting product descriptions of products and buttons via mapping. Does it change your code suggestion above?

Also, I am not clear on your statement - "In this container you will be able to find hidden label with product id"

Button is sitting inside a grid. But what do you mean by "hidden label with product id". Where in the grid properties will I find it?

Also, the link that u have shared is for a tree. I am not using tree but an array.

Where can I find more info on using "this". Are there any tutorials or any other queries in this forum? I tried searching but could not find.


How to simulate buying a product?

Posted: Sun Jul 20, 2014 5:04 am
by Anil Sagar

Appreciate some help on this pls


How to simulate buying a product?

Posted: Mon Jul 21, 2014 2:29 pm
by Evgene Karachevtsev

Hello Anil,

For each product you should map its id too. And if you don't want to mess the design, you may do this in a hidden label. Your task can be solved by the model of master-detail page. Here is the link to the documentation:
http://devcenter.appery.io/documentat...


How to simulate buying a product?

Posted: Mon Jul 21, 2014 4:15 pm
by Anil Sagar

Thanks Evgene. After a lot of deliberation and some help from the following forum query, I was able to crack it. Although your link above is also good help for anybody who wants to solve this.

https://getsatisfaction.com/apperyio/...

Using this command was quite helpful from the query above:
var id = $(this).parent().find("[name=lblId]").text();

This also clarifies the concept of "parent" component. I can now relate to your earlier answer much better...:-)