|
Rank: Member Groups: Member
Joined: 8/30/2007 Posts: 11
|
I've got a slidemenu I'm populating via code-behind. On the page, I have two img set to run javascript onclick event to expandall or collapseall menu items in the slidemenu. The problem I'm encountering is if there are items already expanded or collapsed, the javascript will still not expand/collapse the item. Or, for example if all are expanded and I click a few to collapse them. Then I do a collapseAll (all will collapse), then expandAll - the expandAll will not expand the ones that I previously collapsed individually. Basically, I want the javascript to expandAll/collapseAll regardless of what's currently there. Thanks in advance for help. Code-Behind:
Code: Visual Basic.NET
do while ......
childItem = New EO.Web.MenuItem
topItem = New EO.Web.MenuItem
topItem.text.Html = "some header text"
childItem.text.Html = "some child text"
topItem.SubMenu.Items.Add(childItem)
ANNOUNCEMENTSLIST.Items.Add(topItem)
If Convert.ToDateTime(dr.Item("POST_END_DATE")) > Date.Today Then
ANNOUNCEMENTSLIST.Items(ANNOUNCEMENTSLIST.Items.Count - 1).Expanded = True
End If
end while
SlideMenu is defined as:
Code: HTML/ASPX
<eo:SlideMenu ID="ANNOUNCEMENTSLIST" Width="100%" runat="server" ControlSkinID="None"
ExpandEmptyPane="True" SingleExpand="false" >
<TopGroup Width="160" Style-CssText="">
</TopGroup>
<LookItems>
<eo:MenuItem ItemID="_TopLevelItem" Height="22" LeftIcon-ExpandedUrl="00020006" LeftIcon-Url="00020007"
Text-NoWrap="False" NormalStyle-CssText="cursor: hand;font-weight:bold;padding-left:5px;background-color:#F7F7DE;border-bottom-color:#dddddd;border-bottom-style:solid;border-bottom-width:1px;color:#000099;"
SelectedStyle-CssText="cursor: hand;font-weight:bold;padding-left:5px;background-color:#CDE6F7;color:#000099;"
Text-Padding-Left="10">
<SubMenu Style-CssText="background-color:White;">
</SubMenu>
</eo:MenuItem>
<eo:MenuItem ItemID="_Default" Text-NoWrap="False" Text-Padding-Left="30">
</eo:MenuItem>
</LookItems>
</eo:SlideMenu>
Javascript to ExpandAll/CollapseAll:
Code: JavaScript
function collapseAll(SlideMenu)
{
var menu = eo_GetObject(SlideMenu);
if (menu!=null)
{
for (var i=0;i<menu.getTopGroup().getItemCount();i++)
{
menu.getTopGroup().getItemByIndex(i).collapseSubMenu();
}
}
}
function expandAll(SlideMenu)
{
var menu = eo_GetObject(SlideMenu);
if (menu!=null)
{
for (var i=0;i<menu.getTopGroup().getItemCount();i++)
{
menu.getTopGroup().getItemByIndex(i).expandSubMenu();
}
}
}
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Make sure you have SingleExpand set to false and ExpandEmptyPane set to true. SingleExpand has a default value as "true" which means expanding one sub menu will automatically collapses other sub menus.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 8/30/2007 Posts: 11
|
Hi,
Actually both settings are already defined for the slidemenu. Please see above code.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
What version do you use? We could not try your code behind so we tried a static menu from Outlook template and it works fine.
|
|
Rank: Member Groups: Member
Joined: 8/30/2007 Posts: 11
|
I am running dll version 7.0.20.2 I've created a test page and was able to recreate the problem with it. Please try it out. I encounter the problem when I do this sequence: 1) Open page, there should be ten items in the slidemenu - all expanded. 2) Collapse any items (ex: item 1 and item 2). 3) Click on the "Collapse ALL" span tag. 4) All menu items will collapse. 5) Click on the "Expand ALL" span tag. 6) Items 3-10 will expand, but items 1 and 2 will remain collapsed. I would like to know how to force all items to expand/collapse.
Code: HTML/ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="slidemenu_test.aspx.vb"
Inherits="slidemenu_test" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function collapseAll(SlideMenu)
{
var menu = eo_GetObject(SlideMenu);
if (menu!=null)
{
for (var i=0;i<menu.getTopGroup().getItemCount();i++)
{
menu.getTopGroup().getItemByIndex(i).collapseSubMenu();
}
}
}
function expandAll(SlideMenu)
{
var menu = eo_GetObject(SlideMenu);
if (menu!=null)
{
for (var i=0;ihead>
<body>
<form id="form1" runat="server">
<div style="float: right">
<span style="cursor:pointer" onclick="collapseAll('<%=ANNOUNCEMENTSLIST.ClientID %>');">Collapse ALL</span> |
<span style="cursor:pointer" onclick="expandAll('<%=ANNOUNCEMENTSLIST.ClientID %>');">Expand ALL</span>
</div>
<div>
<eo:SlideMenu ID="ANNOUNCEMENTSLIST" Width="100%" runat="server" ControlSkinID="None"
ExpandEmptyPane="True" SingleExpand="false" Enabled="true">
<TopGroup Width="160">
</TopGroup>
<LookItems>
<eo:MenuItem ItemID="_TopLevelItem" Height="22" LeftIcon-ExpandedUrl="00020006" LeftIcon-Url="00020007"
Text-NoWrap="False" NormalStyle-CssText="cursor: hand;font-weight:bold;padding-left:5px;background-color:#F7F7DE;border-bottom-color:#dddddd;border-bottom-style:solid;border-bottom-width:1px;color:#000099;"
SelectedStyle-CssText="cursor: hand;font-weight:bold;padding-left:5px;background-color:#CDE6F7;color:#000099;"
Text-Padding-Left="10">
<SubMenu Style-CssText="background-color:White;">
</SubMenu>
</eo:MenuItem>
<eo:MenuItem ItemID="_Default" Text-NoWrap="False" Text-Padding-Left="30">
</eo:MenuItem>
</LookItems>
</eo:SlideMenu>
</div>
</form>
</body>
</html>
Code: Visual Basic.NET
Partial Class slidemenu_test
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ANNOUNCEMENTSLIST.Items.Clear()
Dim tmpstr As String
Dim cItem As EO.Web.MenuItem
Dim tItem As EO.Web.MenuItem
For i As Integer = 0 To 10
tItem = New EO.Web.MenuItem
cItem = New EO.Web.MenuItem
tmpstr = i & " Menu Title"
tItem.Text.Html = tmpstr
tmpstr = i & " Description"
cItem.Text.Html = tmpstr
tItem.SubMenu.Items.Add(cItem)
tItem.Expanded = True
ANNOUNCEMENTSLIST.Items.Add(tItem)
Next
End Sub
End Class
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We were able to reproduce and fix the problem. Please expect an update build soon.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We have posted a new build with the fix. Please see your private message for download location.
Thanks!
|
|