Apr 07, 2011, 6:04 PM
[CLOSED] problem creating accordion Dynamically
I am having problem generating accordion dynamically. This accordion is dynamically generatted as the menu content depends on users role and priviledges.
i receive the error mesage Microsoft JScript compilation error: Expected ':' in the executeScript Ext Function. the error is thrown at the underlined code
Regards
i receive the error mesage Microsoft JScript compilation error: Expected ':' in the executeScript Ext Function. the error is thrown at the underlined code
var executeScript = function (o, result, response) {
var delay = 0,
em = o.eventMask || {};
if (em.minDelay) {
delay = em.minDelay;
}
var task = new Ext.util.DelayedTask(
function (o, result, response) {
if (result.script && result.script.length > 0) {
(function (o, result, response) {
eval(result.script); ---------------------------fails here.
}).call(window, o, result, response);
}
this.fireEvent("ajaxrequestcomplete", response, result, o.control, o.eventType, o.action, o.extraParams, o);
if (o.userSuccess) {
o.userSuccess.call(o.control || window, response, result, o.control, o.eventType, o.action, o.extraParams, o);
}
if (o.userComplete) {
o.userComplete.call(o.control || window, true, response, result, o.control, o.eventType, o.action, o.extraParams, o);
}
},
o.scope, [o, result, response]).delay(delay);
};
This is my controller code
//controller action
public AjaxResult GetNavigationMenu()
{
NavigatorMenuItems navigationMenus = new NavigatorMenuItems();
if (this.ContextUser.Identity is IContextIdentity)
{
int id = (this.ContextUser.Identity as IContextIdentity).Id;
navigationMenus = ApplicationContext.ServiceLayerContext.MembershipService.GetUserNavigatorMenuItems(id);
}
AjaxResult response = new AjaxResult();
Container accordion = new Container() { Layout = "Accordion" };
MenuPanel menuPanel= null;
response.Script = "";
foreach (NavigatorMenuItem navigationItem in navigationMenus.NavigatorMenuItemList)
{
menuPanel = new MenuPanel();
menuPanel.ID = navigationItem.NavigatorItemName;
menuPanel.Border = false;
menuPanel.SaveSelection = false;
menuPanel.Cls = "white-menu";
menuPanel.Collapsed = false;
menuPanel.HideCollapseTool = true;
menuPanel.Title = navigationItem.NavigatorItemName;
menuPanel.Icon = Ext.Net.Icon.ArrowMerge;
foreach (NavigatorSubMenuItem subMenu in navigationItem.SubMenuItems)
{
Ext.Net.MenuItem menuitem = new MenuItem();
menuitem.ID = subMenu.NavigatorSubMenuName;
menuitem.Icon = Ext.Net.Icon.ArrowMerge;
menuitem.Text = subMenu.NavigatorSubMenuName;
menuPanel.Menu.Items.Add(menuitem);
}
accordion.Items.Add(menuPanel);
}
response.Script = accordion.ToScript(RenderMode.RenderTo, "westPanel");
return response;
}
view code
<ext:Panel ID="westPanel"
runat="server"
Title="<%$ Resources:WebResources|Home.FormLabels, Navigator %>"
Region="West"
Width="225"
Collapsible="true"
Layout="accordion"
Margins="5 0 5 5" Collapsed="False" Split="true" AutoScroll="True">
</ext:Panel>
on the viewport I have the following event<Render Handler="initAccordion();" />
<script type="text/javascript">
var initAccordion= function ()
{
Ext.net.DirectMethod.request({
url: "/UserSettingArea/UserSetting/GetNavigationMenu",
cleanRequest: true
});
};
</script>
Response is urgently neededRegards
Last edited by Daniil; Apr 15, 2011 at 12:04 PM.
Reason: [CLOSED]