很多天以来,我一直在尝试在 flexigrid 中实现模态对话框编辑,但没有成功。
我从一个非常简单的例子开始:
我对这个示例进行了很多扩展,但遇到了障碍,我不知道如何实现所需的功能。
我实现了以下jquery函数:
函数 RunModalDialog(标题,网址)
{
$("#sform").dialog({
自动打开:假,
显示:“盲”,
closeOnEscape:真,
可调整大小:真,
宽度:1200,
身高:750,
最小高度:600,
最小宽度:950
});
如果(标题)
$("#sform").dialog("option", "title", title);
如果(网址)
$("#sform").load(url).dialog("open");
别的
$("#sform").dialog("open");
我从添加按钮(不带 url)和编辑按钮(带 url)调用它。
Add 可以正常工作(虽然我还没有实现实际的保存和网格刷新),但我不能让它在 Edit 上工作。
这是我的主要视图代码
@model CardNumbers.Objects.Client
@{
ViewBag.Title = "Clients";
}
@section scripts {
<script src="@Url.Content("~/Scripts/Clients.js")" type="text/javascript" ></script>
}
<form id="frmClientsSearch">
<label for="clientNo">Client No: </label>
<input type="number" name="searchClientNo" class="numericOnly" /><br />
<label for="clientName">Client Name: </label>
<input type="text" size="25" value="Please enter the search value" class="SelectOnEntry"
name="searchClientName" />
<input type="button" id="btnClientsSearch" value="Find / Refresh" />
</form>
<div style="padding-left: 150px; padding-top: 50px; padding-bottom: 50px;" id="ClientsResults">
<table id="flexClients" style="display: none">
</table>
</div>
<div id="editor" style ="visibility :hidden ">
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "sform", title = "Client Info" }))
{
@Html.Partial("_ClientForm", Model)
}
</div>
并且客户端控制器的 Edit 方法返回一个视图,它是
@model CardNumbers.Objects.Client
@{
ViewBag.Title = "编辑客户端";
布局 = "~/Views/Shared/_PopupLayout.cshtml";
}
@Html.Partial("_ClientForm", 模型)
@section 脚本 {
@Scripts.Render("~/bundles/jqueryval")
}
I originally had the BeginForm inside the _ClientForm and I could see the form, but the x (close) and Resize didn't work. I now tried moving the line that starts the form outside, but now the behavior is even worse.
Can you tell me how this is supposed to work?