业务场景:
页面A:
在上面的页面A中,我有个列表和新增按钮 选择器页面:
页面使用的是bootstrap+layui.layer
部分页面代码:
<div class="row" id="tableBtn">
<div class="col-sm-12">
<div class="pull-left">
<button class="btn btn-success btn-sm" data-toggle="tooltip" data-placement="left" id="letterAdd" title="添加"><i class="fa fa-plus"></i> 添加</button>
</div>
</div>
</div>
<div class="table-demo">
<table id="table" ></table>
</div> js代码:
function openSelect(data){
var obj=$('#table');
alert(obj);
obj.bootstrapTable('insertRow', {
index: 0,
row: {
Id: 100,
catalog: 'projectNm'
}
});
var data= $('#table').bootstrapTable('getData',{useCurrentPage:true,includeHiddenRows:true});
var rows = $('#table').bootstrapTable('getSelections');
alert(JSON.stringify(rows));
}
新增按钮是一个选择器,我选择完一条或多条数据后,把选中数据的值返回到上面的页面A中,请问我该怎么处理?也就是调用什么方法才能获取到值?
alert(obj);能弹出值,但是显示的是【object object】 方法能够成功调用,就是想把选择器列表中的值返回到A页面中
求各位大大给我点方法或者思路
页面A:
在上面的页面A中,我有个列表和新增按钮 选择器页面:
页面使用的是bootstrap+layui.layer
部分页面代码:
<div class="row" id="tableBtn">
<div class="col-sm-12">
<div class="pull-left">
<button class="btn btn-success btn-sm" data-toggle="tooltip" data-placement="left" id="letterAdd" title="添加"><i class="fa fa-plus"></i> 添加</button>
</div>
</div>
</div>
<div class="table-demo">
<table id="table" ></table>
</div> js代码:
function openSelect(data){
var obj=$('#table');
alert(obj);
obj.bootstrapTable('insertRow', {
index: 0,
row: {
Id: 100,
catalog: 'projectNm'
}
});
var data= $('#table').bootstrapTable('getData',{useCurrentPage:true,includeHiddenRows:true});
var rows = $('#table').bootstrapTable('getSelections');
alert(JSON.stringify(rows));
}
新增按钮是一个选择器,我选择完一条或多条数据后,把选中数据的值返回到上面的页面A中,请问我该怎么处理?也就是调用什么方法才能获取到值?
alert(obj);能弹出值,但是显示的是【object object】 方法能够成功调用,就是想把选择器列表中的值返回到A页面中
求各位大大给我点方法或者思路
alert(obj);
obj.bootstrapTable('insertRow', {
index: 0,
row: {
Id: 100,
catalog: 'projectNm'
}
}); 刚刚发现没引bootstrap插件,现在的话是我单独引我的数据可行,但是我想把其中的列id,catalog换成我选择器列表中的字段数据,该如何呢?
var obj=$('#table');
alert(obj);
obj.bootstrapTable('insertRow', {
index: 0,
row: {
Id: data.projectNm,
catalog: data.id,
}
}); 那么问题真的来了,我如果在选择器中选择多条数据,想要把多条数据获取到其中,我该如何写