在 easyui中获取form表单中所有提交的数据 拼接到table列表中
阅读原文时间:2023年07月08日阅读:1

form表单=====

js代码=======

var data = $('#usingProdctMsgform').serializeArray();//usingProdctMsgform   form表单id
//alert(JSON.stringify(data));
var json={};
for(var i=0;i<data.length;i++){
json[data[i]['name']]=data[i]['value'];
}
//alert(JSON.stringify(json));

//alert(JSON.stringify(json));
$('#usingProductTableUpdate').datagrid('appendRow', json);

table表单======

$('#usingProductTableUpdate').datagrid({
width: 'auto',
height:'200px',
striped: true,
fit: true,
pagination: true,
scrollbarSize: 0,
singleSelect: true,
url:'',
loadMsg: '数据加载中请稍后……',
columns: [[{
field: 'bad_survey_no',
title: '不良调查编号',
align: 'center',
resizable: false,
width: '10%'
},{
field: 'product_name',
title: '商品名称',
align: 'center',
resizable: false,
width: '15%'
},{
field: 'product_no',
title: '产品编号',
align: 'center',
resizable: false,
width: '18%'
}, {
field: 'starttime_frame',
title: '用药开始时间',
align: 'center',
resizable: false,
width: '18%'
}, {
field: 'endtime_frame',
title: '用药结束时间',
align: 'center',
resizable: false,
width: '18%'
}, {
field: 'common_name',
title: '通用名称',
align: 'center',
resizable: false,
width: '16%'
}
]],
method: 'post',
toolbar: [{
text:'清空',
iconCls: 'icon-help',
handler: function(){
$.messager.confirm('删除数据', '您确定清空数据吗?', function(r){
//清空类表数据
$('#usingProductTableUpdate').datagrid('loadData', {total: 0, rows: []});
});
}
}]
});
})

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章