<style type="text/css">
/* 防止下拉框的下拉列表被隐藏---必须设置--- */
.layui-table-cell {
overflow: visible !important;
}
/* 使得下拉框与单元格刚好合适 */
td .layui-form-select {
margin-top: -10px;
margin-left: -15px;
margin-right: -15px;
}
#div2 .layui-form-select{
height:30px;
}
#div2 .layui-select-title{
height:30px;
}
#div2 .layui-unselect{
height:30px;
}
#div2 .layui-anim-upbit{
top:30px;
}
</style>
<script type="text/html" id="inputType">
<select lay-filter="inputParamType">
<option value="Int">Int</option>
<option value="String">String</option>
<option value="Long">Long</option>
<option value="Number">Number</option>
<option value="Double">Double</option>
<option value="Date">Date</option>
<option value="Boolean">Boolean</option>
<option value="Char">Char</option>
<option value="Blob">Blob</option>
<option value="Clob">Clob</option>
</select>
</script>
var table1 = layui.table;
table1.render({
elem: '#demo1'
, height: 'full-200'
, url: '../dhrk/getList_mx' //数据接口
, title: '用户表'
, size: 'sm'
, page: true //开启分页
//, toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
//, defaultToolbar: ['filter', 'exports', 'print']
//, totalRow: true //开启合计行
, limits: [200]
, limit: 200
//, field: 'wealth', type: 'desc', sort: true
, cols: [[ //表头
//{ type: 'checkbox', fixed: 'left' }
//, { field: 'id', title: 'ID', width: 80, sort: true, fixed: 'left', totalRowText: '合计:' }//实例用
//, { field: 'experience', title: '积分', width: 90, sort: true, totalRow: true }//实例用
{ field: 'keep_1', title: '排序', width: 60 }
, { field: 'clbm0', title: '入库单号', width: 150 }
, { field: 'clmc', title: '入库日期', width: 100 }
, { field: 'ggxh', title: '入库单位', width: 130 }
, { field: 'jldw', title: '入库人', width: 80 }
, { field: 'dhsl', title: '到货来源', width: 90 }
, { field: 'km', title: '供货商', width: 90, templet: '#inputType' }
, { field: 'bz', title: '摘要', width: 110 }
, { fixed: 'right', width: 220, align: 'center', toolbar: '#barDemo' }
]]
//, done: function (res, curr, count) {
// data_mx = res.data;
// }
, done: function (res, curr, count) {
//初始化select
var data = res.data;
var rklxs2 = $("#div2_1").find(".rklxs1");
var kms2 = $("#div2_1").find(".kms1");
for (var i = 0; i < data.length; i++) {
if (data[i]["rklxbm"] == null) {
}
else {
$(rklxs2.eq(i)).val(data[i]["rklxbm"]);
}
if (data[i]["kh"] == null) {
}
else {
$(kms2.eq(i)).val(data[i]["kh"]);
}
}
renderForm();
}
});
//监听行单击事件(双击事件为:rowDouble)
table1.on('row(demo1)', function (obj) {
id_mx = obj.data["ID"];//获取被点击行的id
});
form.on("select", function (data) {
var e = data.elem;//获取元素
var e_l = $(e).attr("lay-filter"); //相关的字段
var d = data.value; //值
//id_mx 该行的id值
});