Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: JQueryUI
Hi,
 
Is it possible to disable JQuery UI accordion headers in JQ UI 1.8 , so i cant open them? For example i have step 1 till step 4. And i can only open step 2 if i saved step 1.
 $(function() {
     var icons = {
            header: "h3",
            activeHeader: "ui-icon-circle-arrow-s"
     };
        $( "#prod_accordion" ).accordion({
        	active:<?php echo $db_obj->getValue('status') ? 'acc_'.$tab_status : 'acc_0'; ?>,
            icons: icons,
            autoHeight: false,
            change: function(event, ui) {
            	var newIndex = $(ui.newHeader).index('h3');
            	if (jQuery.inArray(newIndex , accordion_array) == -1) {
            		var oldIndex = $(ui.oldHeader).index('h3');
            		$(this).accordion('activate' , oldIndex);
            	}
            }
 
        });
    });
Posted 21-Nov-12 4:00am
T0mii604
Edited 29-Nov-12 20:10pm
v2
Comments
Sk. Tajbir at 21-Nov-12 10:17am
   
Can you share your code ?
Ed Nutting at 21-Nov-12 11:20am
   
Yes. Now work out how :)
 
You didn't indicate that you had actually tried to solve this yourself, so you shouldn't be expecting anything more than a "yes" or "no" answer...
 
Ed
G0geta at 21-Nov-12 11:22am
   
ofc i post it tomorrow in the morning no problem. :)
G0geta at 22-Nov-12 3:53am
   
[Moved by OP to the question — SA]
Sergey Alexandrovich Kryukov at 28-Nov-12 18:02pm
   
Could you move it to your question where you can format it properly with HTML tag "pre"? Use Improve question...
--SA
G0geta at 30-Nov-12 2:10am
   
moved
Sergey Alexandrovich Kryukov at 30-Nov-12 13:29pm
   
Thanks. Let me see...
--SA
G0geta at 27-Nov-12 3:38am
   
anny suggestions? :)

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I found a way and i thought ill share it hopefully it will help some one else a lot. Smile | :)
 
 $(function() {
     var icons = {
            header: "h3",
            activeHeader: "ui-icon-circle-arrow-s"
     };
        $( "#prod_accordion" ).accordion({
            active:<?php echo $db_obj-?>getValue('status') ? 'acc_'.$tab_status : 'acc_0'; ?>,
            icons: icons,
            autoHeight: false,
            beforeActivate: function(event, ui) {
                var newIndex = $(ui.newHeader).index('h3');
                if (jQuery.inArray(newIndex , accordion_array) == -1) {
                    event.preventDefault();
                }
            }
 
        });
    });
 
the accrodion_array is an array with indexes like (1,2,3,4) and i check if the index of the clicked accordion lets say 5 is in the array. If not then perventDefault() and the accordion header wont open.
 
if u add
ui.addClass('ui-state-disabled');
to the accordion headers that are not in the array the user will now what accordion he cant open. Smile | :)
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 480
1 mhegazy94 460
2 Ravi Bhavnani 190
3 Kornfeld Eliyahu Peter 185
4 Shemeemsha RA 160
0 Sergey Alexandrovich Kryukov 7,135
1 OriginalGriff 6,801
2 CPallini 5,350
3 George Jonsson 3,619
4 Gihan Liyanage 2,797


Advertise | Privacy | Mobile
Web03 | 2.8.140922.1 | Last Updated 14 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100