function loadData() {
var url = "${ctx }/sys/marketing/product/page";
$('#tablepager').bootstrapTable({
url: url,
dataType: "json",
pagination: true, //分页
singleSelect: true,//只能选择一行
clickToSelect: true,
search: false, //显示搜索框
sidePagination: "server", //服务端处理分
pageNumber: 1,
pageSize: 10,
pageList: [10, 20, 50, 100],
queryParams:function(params){
var par={"markingCode":$("#searchmarkingCode").val(),"markingName":$("#searchMarkingName").val(),"productCode":$("#searchproductCode").val(),"productName":$("#searchProductName").val(),"productType":$("#searchproductType").val(),};
var p= $.extend({},params,par);
return p;
},
showColumns: true,
showRefresh: true,
showToggle: true,
toolbar: "#tableToolbar",
onEditableSave: function (field, row, oldValue, $el) {
$.ajax({
type: "post",
url: "${ctx }/sys/marketing/product/" + row.id,
data:{ "_method": "put","id":row.id,"markingName":row.markingName,"productType":row.productType,
"markingPrice":row.markingPrice,"productName":row.productName,"markingCode":row.markingCode,
"productCode":row.productCode},
dataType: 'JSON',
success: function (data, textStatus, jqXHR) {
layer.msg("编辑成功", {icon: 7});
},
error: function () {
layer.msg("error", {icon: 7});
},
complete: function () { }
});
},
columns: [{
checkbox: true
},
{
field : "markingCode",
title : "活动编码"
}
,
{
field : "markingName",
title : "活动名称"
}
,
{
field : "productCode",
title : "产品编码"
}
,
{
field : "productName",
title : "产品名称"
}
,
{
field : "markingPrice",
title : "活动价格(¥)",
editable: {
type: 'text',
title: '活动价格(¥)',
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 '请输入正确的价格';
}
},
}
}
,
{
field : "productType",
title : "产品类型",
formatter: function (value) {
switch (value) {
case 1:
return "门票";
case 2:
return "酒店";
case 3:
return "餐饮";
case 4:
return "普通商品";
default:
return "-";
}
}
}
],
});
}

bootstrap editable初始化后表单的更多相关文章

  1. bootstrap editable初始化后表单可修改数据

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

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

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

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

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

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

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

  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. python 利用 smtplib发邮件

    import smtplib from email.mime.text import MIMEText title = "request build error" content ...

  2. 使用Jenkins结合Gogs和SonarQube对项目代码进行测试、部署、回滚,以及使用keepalived+haproxy调度至后端tomcat

    0 环境说明 主tomcat:192.168.0.112 备tomcat:192.168.0.183 haproxy+keepalived-1:192.168.0.156 haproxy+keepal ...

  3. nginx正常启动,ip直接访问失败问题

    1.查看iptables服务示范启动 service iptables status 2.没有安装的话安装 yum install iptables-services 3.修改配置文件, 添加一行: ...

  4. window常见事件onload

    1, window.onload 是窗口(页面)加载事件,当文档内容完全加载完成会触发该事件(包括图像,脚本文件,css文件等),就调用的处理函数 下面的代码,当点击按钮,并不会弹出对话框,因为页面还 ...

  5. 关于echarts 重绘/图表切换/数据清空

    容器id 为main var myChart=document.getElementById("main") myChart.removeAttribute("_echa ...

  6. GUID在安全中作用及生成方法

    参考改进于http://blog.csdn.net/jcicheng/article/details/743934 全球唯一标识符 (GUID) 是一个字母数字标识符,用于指示产品的唯一性安装.在许多 ...

  7. 2019-11-29-git-需要知道的1000个问题

    title author date CreateTime categories git 需要知道的1000个问题 lindexi 2019-11-29 8:36:7 +0800 2018-2-13 1 ...

  8. 2019-11-29-VisualStudio-使用新项目格式快速打出-Nuget-包

    title author date CreateTime categories VisualStudio 使用新项目格式快速打出 Nuget 包 lindexi 2019-11-29 10:15:25 ...

  9. Nagios监控系统部署(源码)(四)

    Nagios监控系统部署(源码)   1. 概述2. 部署Nagios2.1 创建Nagios用户组2.2 下载Nagios和Nagios-plugin源码2.3 编译安装3. 部署Nagios-pl ...

  10. $.getJSON同步和异步

    $.ajaxSettings.async = false; $.getJSON(url, data, function(data){ }); $.getJSON(url, data, function ...