Need "collapse all groups" for list option "Group by"

As per our Skype conversation (you seem to have disappeared, and I need to sleep!):

[4:53:19 AM] Hugh Messenger: OK, looks like we missed something out in that code ...
[4:53:29 AM] Hugh Messenger: In the three lines like this:
[4:53:31 AM] Hugh Messenger: document.id('toggleGrouped2').addEvent('click', function () {
[4:53:49 AM] Hugh Messenger: can you add e in the function call, like this:
[4:53:52 AM] Hugh Messenger: document.id('toggleGrouped2').addEvent('click', function (e) {

That should fix it.

-- hugh
 
Thanks hugh, now it works

But i have 1 little more question:
I try to add this code for more than 1 list -
list 129 and list 87

Code:
<script type="text/javascript">
 window.addEvent('domready', function () {
      document.id('toggleGrouped1').addEvent('click', function (e) {
        var list = Fabrik.blocks
['list_129_com_fabrik_129','list_87_com_fabrik_87'];
        e.stop();
        list.groupToggle.toggle();
      });
  });

Link to this code appear on list_129 and list_87 but code works (collapse/expand/toggle) only on list_87

Is possible to code it for 2 list?
 
You need to change these lines:

Code:
 var list = Fabrik.blocks['list_129_com_fabrik_129','list_87_com_fabrik_87'];

... so they only reference one list, the one on the page. So ...

Code:
 var list = Fabrik.blocks['list_129_com_fabrik_129'];

... in the code for list 129, and ...

Code:
 var list = Fabrik.blocks['list_87_com_fabrik_87'];

... in the code for list 87.

-- hugh
 
But in that way i have to add 6x <a> code and i have on 1 template 2x (toggle, expand, collapse) - each for 1 list but i see those 2 on both lists (87, 129).
Code:
<a id="toggleGrouped1">Toggle</a>

<a id="toggleGrouped2">Expand</a>
<a id="toggleGrouped3">Collapse</a>

<a id="toggleGrouped4">Toggle</a>
<a id="toggleGrouped5">Expand</a>
<a id="toggleGrouped6">Collapse</a>

Is not possible to have on both list_87 and list_129 one code <a id="toggleGrouped1">Toggle</a>
that works for this 2 lists?
 
So, OK i can use only 1 x (toggle, collapse, expand) on template.

I have actually this in that way, and it works for those two list_87 and list_129.
Is this the right way to code it for 2 or more lists in 1 template?

Code:
<a id="toggleGrouped1" href="#">&nbsp;Toggle&nbsp;</a>

<script type="text/javascript">

 window.addEvent('domready', function () {
      document.id('toggleGrouped1').addEvent('click', function (e) {
        var list = Fabrik.blocks['list_87_com_fabrik_87'];
        e.stop();
        list.groupToggle.toggle();
      });
  });


 window.addEvent('domready', function () {
      document.id('toggleGrouped1').addEvent('click', function (e) {
        var list = Fabrik.blocks['list_129_com_fabrik_129'];
        e.stop();
        list.groupToggle.toggle();
      });
  });
</script>
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top