关于使用layer弹层插件获取其返回值
2017-12-13 16:50
471 查看
此时做的是mvc项目,现在需要一个页面上有弹出层显示数据供选择,然后返回到该页面,用到的是layer插件,还是比较强大的。
首先弹出层里面我是自定义的页面,所以单独新建了一个页面将数据来显示在弹层里,创建了一个表格,效果如下:
代码如下:
将此写进调用方法即可,具体可参照layer官方说明查看各个属性,效果如下:
success属性即成功弹出后执行的内容,
首先弹出层里面我是自定义的页面,所以单独新建了一个页面将数据来显示在弹层里,创建了一个表格,效果如下:
代码如下:
<div> <table id="table0" class="am-table am-table-radius am-table-striped "> <thead> <tr> <th>序号</th> <th>指标名称</th> <th>评价方式</th> <th>指标项</th> <th>指标项内容</th> <th>创建人</th> <th>创建时间</th> <th>操作</th> </tr> </thead> @if (Model != null && Model.Rows.Count > 0) { for (int i = 0; i < Model.Rows.Count; i++) { <tbody> <tr> <td id="indexid" style="display:none"><span>@Model.Rows[i]["id"]</span></td> <td>@(i + 1)</td> <td>@Model.Rows[i]["IndexName"]</td> <td>@Model.Rows[i]["EvaluateType"]</td> <td>@Model.Rows[i]["OptionName"]</td> <td>@Model.Rows[i]["LevelNumber"]</td> <td>@Model.Rows[i]["UserName"]</td> <td>@Model.Rows[i]["CreatTime"]</td> <td> <a class="am-btn am-btn-success am-btn-xs am-icon-hand-pointer-o" data-id="@Model.Rows[i]["id"]"> 选择</a> </tr> </tbody> } } </table> </div>然后我再另一个页面用layer调用该页面代码如下:
top.SearchTeacherLayerId = top.layer.open({ title: "资源属性", type: 2, shadeClose: true, area: ['85%', '590px'], content: 'http://localhost:58949/Teacher/PrepareLesson/ResourceAttribute', success: function () { $(top.document.body).find('#layui-layer-iframe' + top.SearchTeacherLayerId).contents().find("td a").on('click', function () { alert($(this).attr('data-id')); top.layer.close(top.SearchTeacherLayerId); }); } });
将此写进调用方法即可,具体可参照layer官方说明查看各个属性,效果如下:
success属性即成功弹出后执行的内容,
alert($(this).attr('data-id'))就可以获取到在弹层里点击选择所获取到的当前ID
相关文章推荐
- 关于使用struts2-json-plugin 插件,Json返回List对象数据为空解决方案
- J2EE 关于WebLogic下应用使用URL.openConnection获取连接返回 HttpsURLConnection与SOAPHttpsURLConnection的问题
- 关于Jquery中的$.each获取各种返回类型数据的使用方法
- 关于weblogic下使用URL.openConnection获取连接返回javax.net.ssl.SSLKeyException错误
- 关于Java Web使用的DataTables插件获取所有数据以及表格刷新
- 关于weblogic下使用URL.openConnection获取连接返回javax.net.ssl.SSLKeyException错误
- layer 弹层插件使用1
- 关于微信第三方授权登陆 使用code获取token时返回40029
- J2EE 关于WebLogic下应用使用URL.openConnection获取连接返回 HttpsURLConnection与SOAPHttpsURLConnection的问题
- 关于Artdialog插件中获取内部表单元素值的使用心得
- 解决在 使用 AjaxFileUploder 插件时,不能获取返回的 json 结果数据
- 关于Jquery中的$.each获取各种返回类型数据的使用方法
- 关于WebLogic下应用使用URL.openConnection获取连接返回 HttpsURLConnection与SOAPHttpsURLConnection的问题
- J2EE 关于WebLogic下应用使用URL.openConnection获取连接返回 HttpsURLConnection与SOAPHttpsURLConnection的问题
- 关于JqueryPaginaton分页插件的使用以及刷新数据返回第1页问题处理
- (转)在C#中使用WIA获取扫描仪数据(二、WIA Automation Layer)
- 关于读取HttpWebRequest获取的服务器返回流的问题总结
- 在vb中使用Iphlpapi.dll获取网络信息 第二章 第十四节 返回本机网络接口数量
- 如何使用Dexexpress插件,获取一个文本框中的内容
- 关于C#中使用消息获取Message.LParam所包含的数据