I'm subscribing to my bootstrap modal close event using
我正在订阅我的bootstrap模态关闭事件
$(function () {
$('#myModal').on('hidden.bs.modal', function() {
jQuery("#jqGrid2").jqGrid('setGridParam', { url: "/Types/GetTypes?sectionid=" + $('#Sections').val(), page: 1, $('#Sections').text }).trigger('reloadGrid');
});
});
which works fine, it updates my jqgrid, Im using the same modal throughout my website but using different partials in it. now on one of my pages I need to update the grid if the user is adding a product to the grid and I use a modal to display a partial to them, but if they are adding a product type in the same modal but different partial I need to add that type to my dropdown list then update the dropdown list, is there a way I can attach a different id to the modal everytime i open it and use that id in the closed event? so I could say in my close event if id equals 1 update my grid, else if equals 2 update my dropdown with the new value the user typed into my partial form?
哪个工作正常,它更新我的jqgrid,我在我的网站使用相同的模式,但使用不同的部分。现在在我的一个页面上我需要更新网格,如果用户正在向网格添加产品并且我使用模态显示它们的部分,但是如果他们在同一模态中添加产品类型但不同的部分我需要将该类型添加到我的下拉列表然后更新下拉列表,有没有一种方法我可以在每次打开它时将不同的id附加到模态并在关闭的事件中使用该ID?所以我可以在我的关闭事件中说如果id等于1更新我的网格,否则如果等于2更新我的下拉列表,用户键入我的部分表单的新值?
regards
1 个解决方案
#1
0
I went down the route of just adding a new modal with a different id, added a new function to handle the close eventand some new javascript to open the modal and it works fine, I asked because I didn't want to get into the position of having lots of modals everywhere.
我沿着刚刚添加一个具有不同id的新模态的路线,添加了一个新函数来处理close事件和一些新的javascript来打开模态并且它工作正常,我问因为我不想进入这个位置到处都有很多模态
#1
0
I went down the route of just adding a new modal with a different id, added a new function to handle the close eventand some new javascript to open the modal and it works fine, I asked because I didn't want to get into the position of having lots of modals everywhere.
我沿着刚刚添加一个具有不同id的新模态的路线,添加了一个新函数来处理close事件和一些新的javascript来打开模态并且它工作正常,我问因为我不想进入这个位置到处都有很多模态