CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Programmatically expand accordion tab

by buzud » 02 Mar 2017 12:48

I use a side panel and inside I have an accordion.
Now I want before to open side panel , to set accordion tab collapsed = true/false

what I did: .SidePanelJQMSidePanelOptionsBeforeOpen
SideAccordion.ActiveTab := SideTabFilter;
SideTabFilter.JQMAccordionOptions.Collapsed := false;
SideTabQuikEdit.JQMAccordionOptions.Collapsed := True;

where Accordion = SideAccordion and tabs are SideTabFilter and SideTabQuikEdit

then when side panel is open i expect to have the accordion expanded on selected tab
If I run ajaxrerender, all goes wrong.

What I missing here ?
Thanks!

properties for sidepanel and accordion
SidePanel.JQMSidePanelOptions.Position := jqmsppRight;
SidePanel.JQMSidePanelOptions.PositionFixed := true;
SidePanel.JQMSidePanelOptions.Display := jqmspdOverlay;
SidePanel.JQMSidePanelOptions.Theme := 'b';
SidePanel.JQMSidePanelOptions.Animate := true;
SidePanel.JQMSidePanelOptions.SwipeClose := true;

{side accordion}
SideAccordion.GroupTabs:= True;
buzud
 
Posts: 17
Joined: 18 Oct 2016 13:29

by buzud » 03 Mar 2017 11:10

I try different aproach: onbutton click script

On region content render:
Code: Select all
BtnExpandFirst.JQMButtonOptions.Events.OnVClick.Script :=
     $("#btnFirst").click(function() {
        $("#myAccordion").children("#myTab1").trigger( "expand" );
    });
where
  MyAccordion.Css := 'myAccordion';
  MyAccordionFirstTab.Css := 'myTab1';
  BtnExpandFirst.css := 'btnFirst';

I try this code on an web editor with JQuery 1.3.1 and is working ok. When I add to delphi, not, page is loading and loading....
What can be the problem, outside is ok, in delphi not ?! Can be the version of Jquesry mobile from 1.3.1 to 1.3.2 used by CGDevtools?
buzud
 
Posts: 17
Joined: 18 Oct 2016 13:29

by Jorge Sousa » 03 Mar 2017 13:32

Hello

Have you tried with

Accordion.JQAccordionOptions.MultiToggleTab

https://www.cgdevtools.com/docs/_html/index.htm?IWCGJQAccordion.TIWCGJQAccordionOptions.MultiToggleTab.htm

or

Accordion.JQAccordionOptions.MultiToggleTabs

https://www.cgdevtools.com/docs/_html/index.htm?IWCGJQAccordion.TIWCGJQAccordionOptions.MultiToggleTabs.htm

About your script code, there is nothing to do with the (ancient) jquery version, Intraweb is currently using jquery version 1.8.2.

Your code is wrong

The jQuery selectors started with # determine an element id and you want to use a class, so you should had change to
.btnFirst and .Accordion

since you are doing this:

MyAccordion.Css := 'myAccordion';
BtnExpandFirst.css := 'btnFirst';

if you want to use the ids with the symbol #

you better use our script macro <# ControlName #>

$(<#BtnExpandFirst#>)
and
$(<#MyAccordion#>)

and you don't need to set the classes.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by buzud » 03 Mar 2017 16:48

Thank you for response.

I am not very familiar with javascript...but seems I need to learn very fast :) to can use this components.
You did a great work, but is a little difficult for me at the beginning.

Second, the Accordion.JQAccordionOptions.MultiToggleTab is not available for mobile accordion. At list I did not find it.
SideAccordion: TIWCGJQMAccordion;
I found doc as: https://www.cgdevtools.com/docs/_html/index.htm?IWCGJQMAccordion.TIWCGJQMAccordion.htm

I use finally something like:
SideAccordion.ActiveTab := tab1;
SideAccordion.AjaxReRender(false,true);

and seems is working with mobile accordion.

Best regards,
Dan
buzud
 
Posts: 17
Joined: 18 Oct 2016 13:29

by Jorge Sousa » 04 Mar 2017 13:08

Hello

Oops, my bad, i didn't notice you were referring mobile accordion, sorry.

Code: Select all
SideAccordion.ActiveTab := tab1;
SideAccordion.AjaxReRender(false,true);


This is the right way to do what you need, I'm glad you found it by your own :)
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQMAccordion

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.