I have an issue with the WebToolbar that I can't seem to figure out.
We need to hide the second last button on hour toolbar (on the client side). We don't want to just disable it.
The way I am currently hiding the button is to get a reference to that button and hide it's element. TD
tbButton.Element.style.display = "none";
The problem is that all the buttons are 25px except that button which is 120px. When I hide it the next button is now 120px not 25px. I think this is happening because of the width specified in the colHeader. This is a problem because I am using CSS Sprites (background-image + background-position) to display the icons in the toolbar for performance reasons and now the last button is showing too much of the background-image because of the width problem.
Is there a way that I can hide the whole column of an HTML table using javascript?
Or does anyone have any other ideas? I'd appreciate any suggestions anyone might have.
Thanks,
Amy
The toolbar auto fills when button widths aren't specified. You'll want to specify an ItemWidthDefault on the toolbar to prevent it from filling itself with the last item. You can also set the width explicitly on each toolbar item. Even though your using sprites with CSS, you should still have the ability to set an item-width on the server, right? If not, I'm sure there's a combination of css that can get you where you need to be, but it may not be very pretty.
You can also use tbButton.Element.style.visibility="hidden" to hide the button, but preserve the layout. I'd probably go this route if you can, as it's a pretty quick and easy change.
-Tony
Hi Tony,
I already had the ItemWidthDefault set. I tried specifying a width for each button on the toolbar but that didn't work either. When I view-source I can see that the width of the column is specified in the colHeader. So when I hide the cell that the button is in the next cell assumes the colHeader width.
We need to hide the button client-side so I can't change the width on the server but I would think that would work if I could.
Setting the visibilty to 'hidden' would work but there would be a big gap in the display of the toolbar.
In the end we just re-arranged the buttons so that the last button is the one that gets hidden and this resolved the issue.
Thanks anyways,
Hi Amy,
Infragistics has a great object model on WebToolbar. You can get a reference to WebToolbar control on the client site and hidden your button with following call:
WebToolbar.Items[1].isVisible = false;
Why Infragistics not use setVisible-methode like UltraWebTab-control - I don't know...
Now, we are using a custum client objekt -> http://www.drescher-hackel.de/default,date,2007-07-22.aspx
on client site I am using:
_co[_co.Type] = function(){
var d = arguments.length == 1 ? arguments[0] == true ? "block" : "none" : "none";
o.Items.Element.style.display = d;
}
break;