Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ron P on Mar 31, 2009 14:46
open dhtmlx forum
Accordian with Menu inside each section

I'd like to create an accordian with menus inside each section with rollover effects. Is there a way to do this easily?

The trouble I am having is that if I use straight HTML inside each section of the accordian then I have trouble getting the individual items to properly size across all browsers.

This is an example of what I'm trying to achieve... http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-glossy.htm

I can accomplish this with some CSS hacks and either tables or unordered lists, however, it would seem as though there would be an easier way to accomplish this using the dhtmlx library.
Answer posted by Alex (support) on Apr 01, 2009 03:40

You can use attachObject mehod to attached the necessary content to the accordion. 

http://dhtmlx.com/docs/products/dhtmlxAccordion/samples/components/attach_object.html

Or you can attach grid with one column: http://dhtmlx.com/docs/products/dhtmlxAccordion/samples/components/grid.html

Answer posted by Ron P on Apr 07, 2009 15:47

re:  Accordian with menu inside

does attach object handle the sizing to 100% or does that all need to be done manually to work through various browsers.

As far as a grid, it seems as though creating a custom style sheet (to get a look similar to the cited example) would be almost as much effort as dealing with the straight HTML with the exception of the cross browser issues.

am I missing something?

Answer posted by Alex (support) on Apr 08, 2009 05:17

The attachObject method just puts the object into the accordion cell. It doesn't make any mofications with its style.

In case of grid you should create a custom skin. The article about it - http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Creating_custom_skin.html

Answer posted by RonP on Apr 08, 2009 10:01

Took a look at the custom skin for the grid and it is a lot easier than I first thought.  This should give me a "menu" with rollover effects. 

The rollover effects were created by enabling LightMouseNavigation, however it appears as though the LightMouseNavigation uses .rowselected.  How would I handle highlighting a row that is clicked, separate and apart from the .rowselected descriptor in the style sheet which is used for the rollover effect.  In other words, when you roll over each cell / menu item the row is highlighted and takes on the .rowselected style.  When you click on a cell / menu item I'm going to add an event and I want that event to be able to change the cell / menu item that was selected to a different background color and to make the font bold as well as to change the previously selected row back to it's "normal" style.

 

Answer posted by Alex (support) on Apr 09, 2009 06:39

There is onRowSelect event. Its handler gets row id and column index of clicked cell. 

grid.attachEvent("onRowSelect",function(id,index){

...

})

To set cell style you can use the setCellTextStyle(row_id,ind,styleString) method.

The full list of events is dhtmlxGrid/doc/events.html. All methods are presented in dhtmlxGrid/doc/alpha.html