Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Custom Component Mapping

I have a custom component that has a picture. On the click of the picture, two local storage variables are mapped to two labels, with the following custom JS on the mapping:

return "Version: "+value;

Problem is, the LSV values are mapping just fine, the rest of the code does not.

The result of this is just the value, which it should not be.

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Custom Component Mapping

I cannot even get it to work using just the custom JS:

var version = Apperyio.storage.information.get("$['version']");
var verDate = Apperyio.storage.information.get("$['version_date']");
var ver = "Version: " + version;
var date = "Date: " + verDate;
console.log(date);
Apperyio("version_value_lbl").val(ver);
Apperyio("version_date_lbl").val(date);

The console.log shows, but nothing else. I also have a problem showing/hiding a grid in a custom component.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Custom Component Mapping

Hello Jack,

Could you check that element's name attribute (https://devcenter.appery.io/documenta...)? Please send us screenshot with it

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Custom Component Mapping

Is this what you are talking about? Image

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Custom Component Mapping

You have to use "MenuGrid_488_version_value_lbl" instead of "version_value_lbl", because Appery.io automatically creates new elements according to custom component

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Custom Component Mapping

Well the code is on the custom component, and the custom component is on multiple pages (it is a menu). "MenuGrid_488_version_value_lbl" will not be the name on each page. I need to reference the label in a way that will work on every page since the numbers in "MenuGrid_488_version_value_lbl" will be different for each menu that is on each page. How can I do this?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Custom Component Mapping

You can use selectors like:

$("[name*=version_value_lbl]") for selection all elements, which has "version_value_lbl" in name

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Custom Component Mapping

I might be doing something wrong here, could you please show me how to use that selector in the code :Apperyio("version_value_lbl").val(ver);

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

Custom Component Mapping

I think the issue arises since there are multiple labels with "version_value_lbl" in their names since this custom component is on every page.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Custom Component Mapping

You have to use:

$("[name*=version_value_lbl]").val(ver);

instead of:
Apperyio("version_value_lbl").val(ver);

Return to “Issues”