function listEditor(data,productCode) {
$('#tab1').bootstrapTable('load', data);
$('#tab1').bootstrapTable({
method:'POST',
dataType:'json',
contentType: "application/x-www-form-urlencoded",
cache: false,
striped: true, //是否显示行间隔色
sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
showColumns:true,
pagination:true,
minimumCountColumns:2,
search: true,
pageNumber:1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
idField: "productCode",
pageList: [10, 15, 20, 25], //可供选择的每页的行数(*)
uniqueId: "id", //每一行的唯一标识,一般为主键列
showExport: true,
singleSelect : true, // 单选checkbox
onEditableSave: function (field, row, oldValue, $el) {
$.ajax({
success: function (data, status) {
console.log(row);
if (status == "success") {
layer.msg("编辑成功", {icon: 7});
}
},
error: function () {
layer.msg("Error", {icon: 7});
},
complete: function () { }
});
},
data: data,
columns: [{
field : 'state',
checkbox:true,
formatter : stateFormatter
},
{
field:'rowId',
title:'序号',
width:30,
align: 'center',
formatter:function(value,row,index){
row.rowId = index;
return index+1;
}},
{
field: 'productCode',
title: '产品编码'
}, {
field: 'productName',
title: '产品名称'
}, {
field: 'markingPrice',
title: '活动价格(¥)',
editable: {
type: 'text',
validate: function (v) {
if ($.trim(v) == '') {
return '活动价格不能为空!';
}
if (isNaN(v)) {
return '活动价格必须是数字';
}
var reg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
if(!reg.test(v)) {
return '请输入正确的价格';
}
}
},
}]
});
}
//对应的函数进行判断;
function stateFormatter(value, row, index) {
if (row.state == true)
return {
disabled : false,//设置是否可用
checked : true//设置选中
};
return value;
}

最新文章

  1. request getParameter getAttribute
  2. Mac系统下配置Maven环境变量
  3. Cacti监控Centos抓包unreachable - admin prohibited
  4. 教你如何利用分布式的思想处理集群的参数配置信息——spring的configurer妙用
  5. python基础整理笔记(一)
  6. poi读写word模板 / java生成word文档
  7. python中zip函数
  8. PHP计算中英混输字符串长度
  9. SQL中游标的使用
  10. OCP-1Z0-051-题目解析-第6题
  11. oracle_一次移动数据库dbf文件的操作
  12. org.springframework.beans.factory.BeanDefinitionStoreException异常
  13. 给Cocos2D视图添加手势支持
  14. SQLyog 报错2058 :连接 mysql 8.0.11 解决方法
  15. iOS逆向开发(2):获取APP的类声明 | class-dump | dumpdecrypted
  16. qrcodebox 面向移动设备的二维码弹出框
  17. 逆袭之旅DAY16.东软实训.Oracle.修改用户
  18. centos7 安装后需要做的事情
  19. node express session
  20. subprocess.Popen 运行windows命令出现“句柄无效”报错的解决方法

热门文章

  1. leecode刷题(29)-- 二叉树的中序遍历
  2. Array.reduce()方法
  3. monkey基础使用教程,如何安装和monkey分析日志
  4. angular.js,IE7,8,9兼容性的处理
  5. dedecms 列表标签 去斜杠 去两边空格
  6. Delphi 控制程序的执行
  7. 反selenium关键字
  8. 去掉或修改lightinthebox网址与标题中Wholesale关键词
  9. spring+mybatis 多数据源的配置
  10. nginx理论基础