• Welcome to Journal web site.

我是 PHP 程序员

- 开发无止境 -

Next
Prev

获取layer.open弹出层中bootstrap table选中行数据_真是适合睡觉的天气的博客

Data: 2020-08-07 12:19:38Form: JournalClick: 0

获取layer.open弹出层中bootstrap table选中行数据
获取layer.open弹出层中bootstrap table选中行数据_真是适合睡觉的天气的博客-CSDN博客

获取弹出层容器

var iframeWin = window[layero.find('iframe')[0]['name']];

 

获取弹出层bootstrap table选中行数据

var selectTemplate = JSON.stringify(iframeWin.$('#bootstrap-table').bootstrapTable('getSelections'));

 

数据格式例如:

[{"0":true,"id":"1","name":"张三",...}]

"0":true 是固定的剩下的是你的行数据,需要自己处理一下

 

弹出层传值到父页面:

 

在弹出层定义一个函数,封装参数

function result(){

 var result = [ids,names];

 return result;

}

或者

function result(){

 var result = {

  ids:ids,

  names:names

 };

    return result;

}

在父页面js调用

var iframeWin = window[layero.find('iframe')[0]['name']];

var lists = iframeWin.result();

或者

var lists = $(layero).find("iframe")[0].contentWindow.result();

然后通过ajax传到后台就可以了

 

//另外一种方法

 var aa="";

var bodys = $(layer.getChildFrame('body', index)); //获取弹框子类

//获取勾选框数值

bodys.find("input[name='btSelectItem']:checkbox:checked").each(function(){

        aa+=$(this).val()+',';

})

console.log(aa);

Name:
<提交>