Click here to Skip to main content
15,905,323 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I created a couple of dijit.TitlePane objects in a HTML file. If one pane is open, I want to close others. Thereofore, I added a onClick() event when a pane is clicked. In the onClick() event, I used
var v1 = document.getElementById(id1);
to get the element. Then I want to set v1.open = true or v1.open = false. However, the v1 variable does not have 'open' defined. How can this problem be solved? Thanks.
Posted
Updated 24-Feb-17 1:07am
Comments
Member 11253323 21-Nov-14 11:05am    
i'm doing Bidding I have done decrement of timer with the javascript but i don't attach it into gridview bcz i keep the product it product name and ctc. but I want to do when timer will finish then that row will invisible.
s yu 21-Nov-14 11:18am    
Your comment appears to be not related to my Q. But I also have the problem you reported. You might post yours as a Q. Have a nice day!

1 solution

Hi,

Please create a html page and paste the below code.
HTML
<html>
    
    <head>
        
            body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
        
		<script>
		
		var dojoConfig = {
			async: true,
			parseOnLoad: true
			
		};
		</script>
        <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js">
        </script>
		
		<script>
		dojo.require("dijit.dijit");
        dojo.require("dijit.TitlePane");
		dojo.require("dijit.form.Button");
		dojo.require("dijit.form.NumberTextBox");
		dojo.require("dijit.Dialog");
		var titlePanes = [];
		dojo.addOnLoad( function(data) {
			
			console.log(dijit.byId('pane1'));
			dojo.connect(dojo.byId('Submit') , 'onclick', function(){
			
			    var counter = dijit.byId('paneCounter').get('value');
				if(counter > 1) {
					titlePanes = [];
					dojo.empty(dojo.byId('container'));
				      for(i=0; i< counter; i++){
							titlePanes.push( new dijit.TitlePane( { 
								title: 'Pane - ' + i ,
								content : 'content of Pane - ' + i,
								onClick : function() {
									dojo.forEach(titlePanes, function(pane){
										pane.set('open',false);
									});
									this.toggle();
								}
							}).placeAt(dojo.byId('container')));
					  }
				} else {
					new dijit.Dialog({
					content: "Enter atleast 2!",
					style: "width: 300px",
					title : 'Alert'
					}).show();
				}
				dojo.forEach(titlePanes, function(pane){
					pane.set('open',false);
				});
			});
			
		});
		</script>
       
    
        
            @import "http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/widget/Portlet/Portlet.css"
        
    </head>
    
    <body class=" claro ">
        
			 How many panes do you want ?  <input dojotype="dijit.form.NumberTextBox" id="paneCounter" /> 
			<input type="button" id="Submit" value="Submit" />
			 
			 
    
		
        
    </body>

</html>
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900