From 55549958843a207ca610a60c62c4f6529bcaa0fa Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Tue, 15 Nov 2016 11:03:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG=EF=BC=9A=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=BC=B9=E6=A1=86=E4=B8=AD=E9=80=89=E6=8B=A9=E7=88=B6?= =?UTF-8?q?=E7=BA=A7=E8=8F=9C=E5=8D=95=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E6=9C=AA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Scripts/Menus.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Bootstrap.Admin/Scripts/Menus.js b/Bootstrap.Admin/Scripts/Menus.js index 5bd6605f..706967c7 100644 --- a/Bootstrap.Admin/Scripts/Menus.js +++ b/Bootstrap.Admin/Scripts/Menus.js @@ -5,6 +5,7 @@ map: { ID: "menuID", ParentId: "parentId", + ParentName: "parentName", Name: "name", Order: "order", Icon: "icon", @@ -77,11 +78,13 @@ var $dialogNew = $dialog.find('div.modal-dialog'); var $dialogIcon = $('#dialogIcon'); var $dialogMenu = $('#dialogSubMenu').find('.modal-content'); - var $btnSubmitMenu = $('btnSubmitMenu'); + var $btnSubmitMenu = $('#btnSubmitMenu'); var $btnPickIcon = $('#btnIcon'); var $inputIcon = $('#icon'); var $nestMenu = $('#nestable_menu'); var $nestMenuInput = $nestMenu.find('div.dd3-content'); + var $parentMenuID = $('#parentId'); + var $parentMenuName = $('#parentName'); $nestMenuInput.find('label:first').hide(); $iconList.find('ul li').addClass('col-md-3 col-sm-4 col-sm-6'); @@ -131,6 +134,12 @@ $nestMenuInput.find('label:last').find('input').show(); $nestMenu.find('li.dd-item').hide().remove('[data-id="0"]'); $nestMenu.find('li[data-category="' + $('#category').selectpicker('val') + '"]').show(); + var pid = $parentMenuID.val(); + if (pid != "") { + // set active class + var radio = $nestMenuInput.find('input[value=' + pid + ']').filter(':radio'); + radio.next('span').addClass('active'); + } $dialogMenu.show().adjustDialog(); }); @@ -145,8 +154,8 @@ var type = $(this).data('type'); switch (type) { case "parent": - $('#parentId').val($('.dd3-content :radio:checked').val()); - $('#parentName').val($('.dd3-content :radio:checked').next('span').text()); + $parentMenuID.val($nestMenuInput.find('input').filter(':radio:checked').val()); + $parentMenuName.val($nestMenuInput.find('input').filter(':radio:checked').next('span').text()); break; case "order": var data = $('#nestable_menu').nestable('serialize');