1. function loadData() {
  2. var url = "${ctx }/sys/marketing/product/page";
  3. $('#tablepager').bootstrapTable({
  4. url: url,
  5. dataType: "json",
  6. pagination: true, //分页
  7. singleSelect: true,//只能选择一行
  8. clickToSelect: true,
  9. search: false, //显示搜索框
  10. sidePagination: "server", //服务端处理分
  11. pageNumber: 1,
  12. pageSize: 10,
  13. pageList: [10, 20, 50, 100],
  14. queryParams:function(params){
  15. var par={"markingCode":$("#searchmarkingCode").val(),"markingName":$("#searchMarkingName").val(),"productCode":$("#searchproductCode").val(),"productName":$("#searchProductName").val(),"productType":$("#searchproductType").val(),};
  16. var p= $.extend({},params,par);
  17. return p;
  18. },
  19. showColumns: true,
  20. showRefresh: true,
  21. showToggle: true,
  22. toolbar: "#tableToolbar",
  23. onEditableSave: function (field, row, oldValue, $el) {
  24. $.ajax({
  25. type: "post",
  26. url: "${ctx }/sys/marketing/product/" + row.id,
  27. data:{ "_method": "put","id":row.id,"markingName":row.markingName,"productType":row.productType,
  28. "markingPrice":row.markingPrice,"productName":row.productName,"markingCode":row.markingCode,
  29. "productCode":row.productCode},
  30. dataType: 'JSON',
  31. success: function (data, textStatus, jqXHR) {
  32. layer.msg("编辑成功", {icon: 7});
  33. },
  34. error: function () {
  35. layer.msg("error", {icon: 7});
  36. },
  37. complete: function () {
  38.  
  39. }
  40. });
  41. },
  42. columns: [{
  43. checkbox: true
  44. },
  45. {
  46. field : "markingCode",
  47. title : "活动编码"
  48. }
  49. ,
  50. {
  51. field : "markingName",
  52. title : "活动名称"
  53. }
  54. ,
  55. {
  56. field : "productCode",
  57. title : "产品编码"
  58. }
  59. ,
  60. {
  61. field : "productName",
  62. title : "产品名称"
  63. }
  64. ,
  65. {
  66. field : "markingPrice",
  67. title : "活动价格(¥)",
  68. editable: {
  69. type: 'text',
  70. title: '活动价格(¥)',
  71. validate: function (v) {
  72. if ($.trim(v) == '') {
  73. return '活动价格不能为空!';
  74. }
  75. if (isNaN(v)) {
  76. return '活动价格必须是数字';
  77. }
  78. var reg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
  79. if(!reg.test(v)) {
  80. return '请输入正确的价格';
  81. }
  82. },
  83. }
  84. }
  85. ,
  86. {
  87. field : "productType",
  88. title : "产品类型",
  89. formatter: function (value) {
  90. switch (value) {
  91. case 1:
  92. return "门票";
  93. case 2:
  94. return "酒店";
  95. case 3:
  96. return "餐饮";
  97. case 4:
  98. return "普通商品";
  99. default:
  100. return "-";
  101. }
  102. }
  103. }
  104. ],
  105. });
  106. }

bootstrap editable初始化后表单可修改数据的更多相关文章

  1. bootstrap editable初始化后表单

    function loadData() { var url = "${ctx }/sys/marketing/product/page"; $('#tablepager').boo ...

  2. Bootstrap学习笔记(二) 表单

    在Bootstrap学习笔记(一) 排版的基础上继续学习Bootstrap的表单,编辑器及head内代码不变. 3-1 基础表单 单中常见的元素主要包括:文本输入框.下拉选择框.单选按钮.复选按钮.文 ...

  3. Bootstrap历练实例:表单帮助文件

    Bootstrap表单控件可以在输入框input上有一个块级帮助文本,为了添加一个占用整个宽度的内容块,请在input后添加help-block. 实例: <!DOCTYPE html>& ...

  4. Bootstrap系列 -- 12. 水平表单

    Bootstrap框架默认的表单是垂直显示风格,但很多时候我们需要的水平表单风格(标签居左,表单控件居右) 在Bootstrap框架中要实现水平表单效果,必须满足以下两个条件: 1.在<form ...

  5. Bootstrap -- 表格样式、表单布局

    Bootstrap -- 表格样式.表单布局 1. 表格的一些样式 举例: <!DOCTYPE html> <html> <head> <meta http- ...

  6. 基于Bootstrap+jQuery.validate Form表单验证实践

    基于Bootstrap jQuery.validate Form表单验证实践 项目结构 :     github 上源码地址:https://github.com/starzou/front-end- ...

  7. php history.back返回后表单数据丢失的解决办法

    js使用history.back返回表单数据丢失的主要原因就是使用了session_start();的原因,该函数会强制当前页面不被缓存.本文章向码农介绍php history.back返回后表单数据 ...

  8. Bootstrap历练实例:表单控件大小

    表单控件大小 您可以分别使用 class .input-lg 和 .col-lg-* 来设置表单的高度和宽度. 实例: <!DOCTYPE html><html><hea ...

  9. Bootstrap历练实例:表单控件状态(禁用的字段集fieldset)

    禁用的字段集 fieldset 对 <fieldset> 添加 disabled 属性来禁用 <fieldset> 内的所有控件. <!DOCTYPE html>& ...

随机推荐

  1. <<C++ Primer>> 第四章 表达式

    术语表 第 4 章 表达式 算术转换(arithmetic conversion): 从一种算术类型转换成另一种算术类型.在二元运算符的上下文中,为了保留精度,算术转换通常把较小的类型转换成较大的类型 ...

  2. phpstorm配合xdebug进行本地调试代码

    笔者在使用的环境是wamp3.1.6和phpstorm2018 ,php选择的环境是php7.2 1. 在php.ini中添加xdebug的配置信息 首先建议是先找对php.ini的位置,可以在php ...

  3. msql 事务

    START TRANSACTION      delete from t_emp    delete from t_deptcommit START TRANSACTION delete from t ...

  4. 邀请好友注册页面光标点到输入框后,输入框会先灰一下。只有ios存在

    输入框会先灰一下.只有ios存在 用这一行代码可以解决问题: -webkit-tap-highlight-color:transparent;

  5. webstorm 如何去掉下划线

    当前webstorm版本:2018.3.5 百度了也没找到解决办法,最终结合了和群友的给的位置,找到了修改地方,只能怪版本迭代太快了,要适应 右上角Effects点掉就可以了

  6. JS实现hasClass addClass removeClass

    // 判断class有无 function hasClass(ele, cls) { if (ele) { cls = cls || '' if (cls.replace(/\s/g, '').len ...

  7. urlencode编/解码

    from urllib.parse import urlencode, quote, unquote # urlencode方法参数是字典 body = { "content": ...

  8. ARIMA模型

    ARIMA模型(英语:Autoregressive Integrated Moving Average model),差分整合移动平均自回归模型,又称整合移动平均自回归模型(移动也可称作滑动),时间序 ...

  9. Java中Collection、Map常用实现类研究分析

    接口/实现类 描述 key是否可为null 为null是否报错 key是否重复 key重复是否报错 key是否和添加一致 是否线程安全 List 一组元素的集合 ArrayList 基于数组存储,读取 ...

  10. python-文件的修改

    python-文件的修改 修改文件的方法 第一种方法: 第二种方法: f=open("my-heart","r") f_new=open("my-he ...