Page 2 of 3

How to access Appery component properties with javascript?

Posted: Mon Jan 06, 2014 8:51 pm
by Maryna Brodina

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


How to access Appery component properties with javascript?

Posted: Mon Jan 06, 2014 8:56 pm
by bahar.wadia

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


How to access Appery component properties with javascript?

Posted: Mon Jan 06, 2014 9:40 pm
by Maryna Brodina

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.


How to access Appery component properties with javascript?

Posted: Fri Dec 05, 2014 6:35 pm
by Mike Maughan

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!


How to access Appery component properties with javascript?

Posted: Fri Dec 05, 2014 8:28 pm
by Evgene Karachevtsev

Hello Mike,

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


How to access Appery component properties with javascript?

Posted: Fri Dec 19, 2014 7:13 pm
by Mike Maughan

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


How to access Appery component properties with javascript?

Posted: Fri Dec 19, 2014 9:10 pm
by Evgene Karachevtsev

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.


How to access Appery component properties with javascript?

Posted: Fri Dec 19, 2014 10:10 pm
by Mike Maughan

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


How to access Appery component properties with javascript?

Posted: Fri Dec 19, 2014 11:11 pm
by Ihor Didevych

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


How to access Appery component properties with javascript?

Posted: Tue Dec 23, 2014 9:27 pm
by Mike Maughan

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?