我正在做类似的事情。当我双击光滑网格中的一行时,会出现一个引导模式。模式显示我使用 AJAX 获取的行的详细信息(以及更多信息)。这工作得很好,z-index 没有问题。
也许我们的方法有点不同,但我希望下面的代码有所帮助。
引导模式
<div id="user-details-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width: 650px">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">User View</h3>
</div>
<div class="modal-body">
<form class="form-horizontal" action="/user/update" method="POST">
<input type="hidden" id="userId" name="userId"/>
<div class="control-group">
<label class="control-label" for="firstName">First Name</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<input class="input-xlarge" type="text" required id="firstName" name="firstName" placeholder="First Name">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="lastName">Last Name</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<input class="input-xlarge" type="text" required id="lastName" name="lastName" placeholder="Last Name">
</div>
</div>
</div>
... more fields
<div class="modal-footer">
<button type="submit" class="btn btn-info">Save Changes</button>
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
光滑的网格设置
setupGrid:(onDblClick)->
grid = new Slick.Grid(@gridId, dataView, @columns, options)
grid.setSelectionModel(new Slick.RowSelectionModel({ selectActiveRow: true }))
grid.onDblClick.subscribe((e, args)->
onDblClick(dataView.getItem(args.row).id);
)
$(window).resize(->
grid.resizeCanvas()
)
显示模态
onDblClick = (id) =>
$userDetails = $('#user-details-modal')
$.get('/user/' + id + '/details')
.success((results)->
$userDetails.find('#userId').val(results.id)
$userDetails.find('#firstName').val(results.FirstName)
$userDetails.find('#lastName').val(results.LastName)
$userDetails.find('#userName').val(results.UserName)
$userDetails.find('#email').val(results.Email)
$userDetails.find('#password').val(results.Password)
$userDetails.modal()
)