Page 1 of 2

Custom Component Mapping

Posted: Thu Sep 17, 2015 2:28 am
by Jack Bua

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.


Custom Component Mapping

Posted: Thu Sep 17, 2015 2:37 am
by Jack Bua

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.


Custom Component Mapping

Posted: Thu Sep 17, 2015 11:08 am
by Serhii Kulibaba

Hello Jack,

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


Custom Component Mapping

Posted: Thu Sep 17, 2015 5:33 pm
by Jack Bua

Is this what you are talking about? Image


Custom Component Mapping

Posted: Wed Sep 23, 2015 7:09 pm
by Serhii Kulibaba

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


Custom Component Mapping

Posted: Wed Sep 23, 2015 7:17 pm
by Jack Bua

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?


Custom Component Mapping

Posted: Wed Sep 23, 2015 7:24 pm
by Serhii Kulibaba

You can use selectors like:

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


Custom Component Mapping

Posted: Wed Sep 23, 2015 7:50 pm
by Jack Bua

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);


Custom Component Mapping

Posted: Wed Sep 23, 2015 8:04 pm
by Jack Bua

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.


Custom Component Mapping

Posted: Thu Sep 24, 2015 7:08 pm
by Serhii Kulibaba

You have to use:

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

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