Tabbar: Automatically adjust Tab's width

I generate dynamically my tabs into the DHTMLXTabbar.
I want the width of each Tab will be the width of my text.

I actually use:

tabbar.addTab(...); tabbar.setLabel(...);

And it’s ok.

Is there a better solution ?


You may set “*” as a tab width. In this case, width will be calculated automatically:


Perfect ! Thanks for you answer.

I am trying to use “*” for adjusting tab width but its giving js error on IE8 can you please help. how can I adjust the same.


its giving js error on IE8
could you attach the demo that reproduces the problem ?

Please see attached JSP file for reference.


			<input type="hidden" name="tabNums" value="5" id="tabNums"/>										

			<div id="dataTabbar" style="*height:150px;height:150px; overflow:auto; width:100%;*width:100%;"></div>

			<!-- div to create tabs-->
				<div id='key0' name="tab1"></div>			
				<div id='key1' name="tab2"></div>							
				<div id='key2' name="tab3"></div>							
				<div id='key3' name="tab4"></div>		
				<div id='key4' name="tab5 tab5 tab5 really long"></div>							

				<!-- hidden variables to find the numbr of tabs & their names as this will be dynamic in nature and number of tabs will change -->	

				<input type="hidden" name="0" value="272" id="0"/>
				<input type="hidden" name="value_0" value="tab1" id="value_0"/>
				<input type="hidden" name="1" value="273" id="1"/>
				<input type="hidden" name="value_1" value="tab2" id="value_1"/>

				<input type="hidden" name="2" value="274" id="2"/>
				<input type="hidden" name="value_2" value="tab3" id="value_2"/>

				<input type="hidden" name="3" value="275" id="3"/>
				<input type="hidden" name="value_3" value="tab4" id="value_3"/>

				<input type="hidden" name="4" value="244" id="4"/>
				<input type="hidden" name="value_4" value="tab5 tab5 tab5 really long" id="value_4"/>