yashmangupta
Posts: 0
Joined: Fri Jun 26, 2015 4:53 pm

Write to Page Component on click of Template Option

Hi,

I have build a template that has Category List. The list is populated from Local Storage and setting the selected value in the selectedCategoryID Local Storage variable using JS when clicked on the item.

Now my another page which uses the same template has a TextArea names mobTextArea. I want to print the chosen Category ID in this TextArea. The JS code that I have written in the template is below. The below code is written in the template mapping. The issue is that it is not printing the ID in the textarea.

element.on("click", function () {
Apperyio.storage.selectedCategoryID.set(value);
Appeyio('mobTextArea').val(Apperyio.storage.selectedCategoryID.get("$['id']"));
});

Appreciate if you can guide.

yashmangupta
Posts: 0
Joined: Fri Jun 26, 2015 4:53 pm

Write to Page Component on click of Template Option

anyone who knows the solution to this issue, please care to share the expertise.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Write to Page Component on click of Template Option

Hello -

Could you please clarify, on what event you're using this JS code?

yashmangupta
Posts: 0
Joined: Fri Jun 26, 2015 4:53 pm

Write to Page Component on click of Template Option

Under template, I have a created a Service by the name of SlidePanel_Category. There are 2 mappings in the Success. First Mapping writes to the Storage and the second Mapping from Storage to the Page list Component (see the attached image)

The textArea is not in the Template file. Moreover, Apperyio.storage.selectedCategoryID.set(value); is not setting the value in the local storage. The code works perfectly If I move everything out from template.

Image

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Write to Page Component on click of Template Option

I can't see on what event you are using this mapping structure, sorry but it is unclear.

yashmangupta
Posts: 0
Joined: Fri Jun 26, 2015 4:53 pm

Write to Page Component on click of Template Option

Illya, here is another snapshot, hope this will make it clear. The event is attached to the template main on page load.

Image

Image

Image

and the code inside is

element.on("click", function () {
Apperyio.storage.selectedCategoryID.set(value);
Appeyio('mobTextArea').val(Apperyio.storage.selectedCategoryID.get("$['id']"));
});

yashmangupta
Posts: 0
Joined: Fri Jun 26, 2015 4:53 pm

Write to Page Component on click of Template Option

hey guys any update...

Pavel Zarudniy
Posts: 0
Joined: Mon Jul 06, 2015 8:56 am

Write to Page Component on click of Template Option

Hi yashmangupta,
For binding event on click list you should use standart events - https://devcenter.appery.io/documenta...

Return to “Issues”