Page 1 of 2

Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Wed Sep 25, 2013 12:53 am
by Garrett

I have a collapsible set that is dynamically populated with the results of a service.

I have a button that is outside of the collapsible set.

I would like to expand a certain collapsible block when the button is clicked.

The targeted collapsible block is based on it's position in the set (for example... I may want to expand the second block down).

I need to be able to do this with JavaScript.

codeAppery('mobilecollapsblock', this).trigger('expand');/code This code by itself won't cut it since the button calling it does not fall inside the block or set.

Any easy way to get the id of a dynamic block based on its index or something like that?

Code samples/examples are much appreciated!


Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Wed Sep 25, 2013 1:55 am
by Igor

Hello,

You could use your code on mobilecollapsibleset click event. It will expand mobilecollapsblock when you click on it,


Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Wed Sep 25, 2013 2:34 am
by Garrett

I don't want to click on it; I want it to be called by a separate button. This is fairly important for the functionality of the app.


Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Wed Sep 25, 2013 7:22 am
by Maryna Brodina

Hello! On button click run the following code:
preAppery("mobilecollapsblock_9").trigger('expand');/pre
where mobilecollapsblock_9 - name of mobilecollapsblock, not entire mobilecollapsibleset, but specific mobilecollapsblock


Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Wed Sep 25, 2013 3:15 pm
by Garrett

The problem is that the collapsibleset is generated from service results and may have 1 block or 1000 blocks.

I ended up using the code you just posted as a reply on the other thread...

[quote:]
codeAppery("mobilecollapsibleset_2").find("[data-role=collapsible]").not("[_tmpl=true]").eq(2).trigger('expand');/code

mobilecollapsibleset_2 - name of entire mobilecollapsibleset
eq(2) - select third element, counting starting 0
[/quote]


Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Wed Sep 25, 2013 5:01 pm
by Kateryna Grynko

Hi Garrett,

This is a good solution.


Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Wed Sep 25, 2013 5:13 pm
by Garrett

I agree. I appreciate everyone's help! You guys are very good about responding quickly.


Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Mon Jul 14, 2014 2:34 am
by bahar.wadia

How would you collapse the block?


Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Mon Jul 14, 2014 9:18 am
by Maryna Brodina

Hello!

Please clarify do you want to collapse collapsible block or call events added on collapse event?


Expanding collapsible set block with a button outside of the collapsible set. Collapsible set is dynamically generated w

Posted: Mon Jul 14, 2014 10:19 am
by bahar.wadia

I want to collapse a collapsible block with JavaScript. Thx