Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to access Appery component properties with javascript?

Hello! Try this way preAppery("gridName").css("background", "#ff0000");
Appery("gridName").css("opacity", "0.4");/pre where gridName - Grid name. But if you map array to Grid there will be created a few clones of Grid on page. In this case you have to use this code pre$("[dsid=gridName]").css("background", "#ff0000");
$("[dsid=gridName]").css("opacity", "0.4");/pre

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

How to access Appery component properties with javascript?

It is actually a grid cell that I am accessing. Also, I have tried the suggestion you are providing, but it does not work.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to access Appery component properties with javascript?

If you work with cell, not Grid use: pre$("[name=mobilegridcell_5]").css("background", "#ffff00");
$("[name=mobilegridcell_5]").css("opacity", "0.1");/prehere in selector name is used instead dsid.

Mike Maughan
Posts: 0
Joined: Wed Feb 19, 2014 10:55 pm

How to access Appery component properties with javascript?

Related to this is the changing of a single style based on the success of a service executed inside one collapsblock of a database populated collapsible set.

This changes only one of the collapsblock headers:
$("[dsid=walkthrough_item_title_0]").css("color", "#00ff00");

How could we replace the "0" in the dsid with a variable to correlate with the $ loop so that the corresponding header of the collapsblock whose service executed successfully only changes and not all of the collapsblock headers or only the same one?

I won't know how many collapsblock headers I'll have so I have to have a rule that is dynamic rather than static.

Thanks!

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How to access Appery component properties with javascript?

Hello Mike,

Please try the following:
pre$("[dsid=walkthroughitem_title"+i+"]").css("color", "#00ff00");/pre

Mike Maughan
Posts: 0
Joined: Wed Feb 19, 2014 10:55 pm

How to access Appery component properties with javascript?

Could you further clarify. For instance, when I do this:
$("a[dsid=mobilebutton_152_0]").css('display', 'none');

it works, but just for that one button (as expected). But when I do this to make it work for each button's corresponding collapsible set, it doesn't work:

$("a[dsid=mobilebutton_152"+i+"]").css('display', 'none');

Any suggestions?

Thanks in advance for your help!

Mike

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How to access Appery component properties with javascript?

Hello Mike,

You need to find it by "name" attribute instead of dsid.
Each component has it's own dsid attribute.
There are plenty examples in this thread.

Mike Maughan
Posts: 0
Joined: Wed Feb 19, 2014 10:55 pm

How to access Appery component properties with javascript?

Perhaps I have the $ variable incorrect? Would it be called "idx" like it is in the html or would I need to create a variable that counted the number of results?

I'm referencing an element within a collapsible set, so using the "name" field just references all of the collapsible within that set. However using the dsid doesn't work with the "+i+" replacing a hardcoded "_0", but when it's hard coded it does work. This makes me think that it's how I"m using "$".

Thoughts? (Thanks!)

Ihor Didevych
Posts: 0
Joined: Wed Nov 19, 2014 7:55 pm

How to access Appery component properties with javascript?

Hi Mike,

You can find all elements with one name with one selector
http://api.jquery.com/attribute-equal... - how to find all elements by name
http://www.w3schools.com/cssref/css_s... - how to write css selector for jquery

Mike Maughan
Posts: 0
Joined: Wed Feb 19, 2014 10:55 pm

How to access Appery component properties with javascript?

That helped a lot, thanks. So I now get the value for the _idx attribute, however I run into issues getting the new value in the next set.

For instance, I have a button in the first collapsible set that runs some jquery when clicked which pulls the value of the _idx attribute and then adds it to the end of an "id" so that I can reference the corresponding div and make some things change in that div upon click. However, when I open the second collapsible set and click the button, the jquery still pulls the value of the _idx of the first collapsible set, and thus makes changes to the first collapsible set on click instead of the second. How would I make it so that it's always getting the _idx value of the active div element or the current collapsible set?

Return to “Issues”