GVKun编程网logo

bootstrap-table的formatter列参数(bootstraptable formatter)

23

在本文中,您将会了解到关于bootstrap-table的formatter列参数的新资讯,同时我们还将为您解释bootstraptableformatter的相关在本文中,我们将带你探索bootst

在本文中,您将会了解到关于bootstrap-table的formatter列参数的新资讯,同时我们还将为您解释bootstraptable formatter的相关在本文中,我们将带你探索bootstrap-table的formatter列参数的奥秘,分析bootstraptable formatter的特点,并给出一些关于ABP module-zero +AdminLTE+Bootstrap Table+jQuery权限管理系统第十二节--小结,Bootstrap Table之角色管理、bootstarp table引入bootstrap-table-editable.js后报错、bootstrap + bootstrap-table + jquery + bootstrap-paginator、Bootstrap 2或Bootstrap 3 for IE 7 Performance Wise的实用技巧。

本文目录一览:

bootstrap-table的formatter列参数(bootstraptable formatter)

bootstrap-table的formatter列参数(bootstraptable formatter)

 
  1. <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

  2. <%@ include file="../../common/taglibs.jsp"%>

  3. <%

  4. String path = request.getcontextpath();

  5. String basePath = request.getScheme() + "://"

  6. + request.getServerName() + ":" + request.getServerPort()

  7. + path + "/";

  8. response.setHeader("x-frame-options", "SAMEORIGIN");// 解决IFrame拒绝的问题

  9. %>

  10. <!DOCTYPE html>

  11. <html>

  12. <head>

  13. <jsp:include page="../../include/title.jsp"></jsp:include>

  14. <style type="text/css">

  15. element.style {

  16. height: 100%;

  17. }

  18.  
  19. .form-horizontal .control-label {

  20. padding-top: 0;

  21. }

  22. </style>

  23. </head>

  24.  
  25.  
  26. <body>

  27. <div>

  28. <div>

  29.  
  30. <divrole="main">

  31. <div>

  32. <div>

  33. <span>产品名称 :

  34. <input size="16" type="text" value="" id="pName" name="pName">

  35. </span>

  36. </div>

  37. <button type="button"id="btn_query">查询</button>

  38. </div>

  39. <div id="toolbar">

  40. <button id="btn_add" type="button"οnclick="add()">

  41. <spanaria-hidden="true"></span>新增

  42. </button>

  43. <!-- <button id="btn_delete" type="button"

  44. οnclick="dels()">

  45. <spanaria-hidden="true"></span>删除

  46. </button> -->

  47. </div>

  48. <table id="tb_departments"></table>

  49. </div>

  50.  
  51. </div>

  52. </div>

  53.  
  54.  
  55.  
  56. <jsp:include page="../../include/bottom.jsp"></jsp:include>

  57. <script type="text/javascript">

  58. $(function() {

  59.  
  60. //1.初始化Table

  61. var oTable = new TableInit();

  62. oTable.Init();

  63.  
  64. });

  65.  
  66. var TableInit = function() {

  67. var oTableInit = new Object();

  68. //初始化Table

  69. oTableInit.Init = function() {

  70. $(''#tb_departments'')

  71. .bootstrapTable(

  72. {

  73. url : ''${ctx}/productInfo/listJSON.action'', //请求后台的URL(*)

  74. method : ''post'', //请求方式(*)

  75. dataType : "json",

  76. contentType : "application/x-www-form-urlencoded; charset=UTF-8",

  77. toolbar : ''#toolbar'', //工具按钮用哪个容器

  78. striped : true, //是否显示行间隔色

  79. cache : false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)

  80. pagination : true, //是否显示分页(*)

  81. sortable : false, //是否启用排序

  82. sortOrder : "asc", //排序方式

  83. queryParams : oTableInit.queryParams,//传递参数(*)

  84. sidePagination : "server", //分页方式:client客户端分页,server服务端分页(*)

  85. pageNumber : 1, //初始化加载第一页,默认第一页

  86. pageSize : 15, //每页的记录行数(*)

  87. Pagelist : [ 15, 25, 50], //可供选择的每页的行数(*)

  88. search : false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大

  89. strictSearch : false,

  90. showColumns : false, //是否显示所有的列

  91. showRefresh : false, //是否显示刷新按钮

  92. minimumCountColumns : 2, //最少允许的列数

  93. clickToSelect : false, //是否启用点击选中行

  94. /* height : 480, *///行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度

  95. uniqueId : "id", //每一行的唯一标识,一般为主键列

  96. showToggle : false, //是否显示详细视图和列表视图的切换按钮

  97. cardView : false, //是否显示详细视图

  98. detailView : false, //是否显示父子表

  99. columns : [

  100. /* 前面 勾选框

  101. {

  102. field : ''ids'',

  103. checkBox : true

  104. }, */

  105. {

  106. field : ''pCode'',

  107. title : ''产品编号'',

  108. align : ''center''

  109. },

  110. {

  111. field : ''pName'',

  112. title : ''产品名称'',

  113. align : ''center''

  114. },

  115. {

  116. field : ''pType'',

  117. title : ''产品类型'',

  118. align : ''center'',

  119. formatter:function(value,row,index){

  120. var value="";

  121. if(row.pType=="1"){

  122. value = "自发货";

  123. }else if(row.pType=="0"){

  124. value = "FBA配送";

  125. }else{

  126. value = row.pType ;

  127. }

  128.  
  129. return value;

  130.  
  131. }

  132. },

  133. {

  134. field : ''pStock'',

  135. title : ''最小库存值'',

  136. align : ''center''

  137. },

  138. /* {

  139. field : ''pDescription'',

  140. title : ''产品描述'',

  141. align : ''center''

  142. }, */

  143. {

  144. field : ''createDate'',

  145. title : ''创建时间'',

  146. align : ''center''

  147. },

  148. {

  149. field : ''id'',

  150. title : ''操作'',

  151. align : ''center'',

  152. formatter : function(value,

  153. row, index) {

  154. var c = ''<ahref="#" οnclick="info(\''''

  155. + row.id

  156. + ''\'')">查看</a> '';

  157. var e = ''<ahref="#" οnclick="input(\''''

  158. + row.id

  159. + ''\'')">编辑</a> '';

  160. var d = ''<ahref="#" οnclick="del(\''''

  161. + row.id

  162. + ''\'')">删除</a> '';

  163. return c + e + d ;

  164. }

  165. }, ]

  166. });

  167.  
  168. };

  169.  
  170. // 分页查询参数,是以键值对的形式设置的

  171. oTableInit.queryParams = function(params) {

  172. var list = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的

  173. limit : params.limit, //每页显示多少条,默认10

  174. offset : params.offset, //页码 ,分页数据偏移量

  175. pName : $("#pName").val(), //角色查询名称

  176. search : params.search

  177. };

  178. return list;

  179. };

  180.  
  181. return oTableInit;

  182. };

  183.  
  184. function del(id) {

  185.  
  186. layer.confirm(''确定要删除?'', {

  187. title : "提示",

  188. }, function() {

  189. $.ajax({

  190. type : "POST",

  191. url : ''${ctx}/productInfo/delete.action?id='' + id,

  192. success : function(data) {

  193. layer.msg("删除产品成功!", {

  194. icon : 1

  195. });

  196. window.location.href = "${ctx}/productInfo/list.action";

  197. }

  198. });

  199. });

  200. };

  201.  
  202. function dels() {

  203. var obj = getIdSelections();

  204. if (obj.length < 1) {

  205. layer.alert(''请选择要删除的选项'', {

  206. title : "提示",

  207. icon : 7

  208. });

  209. return;

  210. }

  211.  
  212. layer.confirm(''确定要删除?'', {

  213. title : "提示"

  214. }, function() {

  215. $.ajax({

  216. type : "POST",

  217. url : ''${ctx}/productInfo/deletes.action'',

  218. data : "ids=" + obj,

  219. success : function(data) {

  220. layer.msg("删除会员成功!", {

  221. icon : 1

  222. });

  223. window.location.href = "${ctx}/productInfo/list.action";

  224. }

  225. });

  226. });

  227. }

  228. function getIdSelections() {

  229. return $.map($(''#tb_departments'').bootstrapTable(''getSelections''),

  230. function(row) {

  231. return row.id;

  232. });

  233. }

  234.  
  235. function add(id) {

  236. layer.open({

  237. title : ''新增产品'',

  238. type : 2,

  239. area : [ ''420px'', ''500px'' ],

  240. resize : false, //是否允许拉伸

  241. /* 弹出框页面 跳转地址 */

  242. content : ''${ctx}/productInfo/input.action'',

  243.  
  244. });

  245. }

  246.  
  247.  
  248. function input(id) {

  249. if (typeof (id) == "undefined") {

  250. id = "";

  251. }

  252. layer.open({

  253. title : ''产品编辑'',

  254. type : 2,

  255. area : [ ''420px'', ''500px'' ],

  256. resize : false, //是否允许拉伸

  257. /* 弹出框页面 跳转地址 */

  258. content : ''${ctx}/productInfo/input.action?id='' + id,

  259.  
  260. });

  261. }

  262.  
  263. //查看页面

  264. function info(id) {

  265. layer.open({

  266. type : 2,

  267. title : ''查看详情'',

  268. area : [ ''360px'', ''460px'' ],

  269. content : ''${ctx}/productInfo/info.action?id='' + id,

  270. });

  271. }

  272.  
  273.  
  274. /*回车 触发 查询按钮 */

  275. $(function() {

  276. document.onkeydown = function(event) {

  277. var e = event || window.event

  278. || arguments.callee.caller.arguments[0];

  279. if (e && e.keyCode == 13) {

  280. $("#btn_query").click();

  281. }

  282. };

  283. });

  284.  
  285. //搜索按钮触发事件

  286. $(function() {

  287. $("#btn_query").click(function() {

  288. $(''#tb_departments'').bootstrapTable(''refreshOptions'', {

  289. pageNumber : 1

  290. }); // 很重要的一步,刷新url!

  291. });

  292.  
  293. });

  294. </script>

  295. </body>

  296. </html>




直接调 
 
  1.  
  2.  
formatter:function(value,row,index)
对后台传入数据 进行操作 对数据重新赋值 返回return到前台

 
 
 
 
  1. {

  2. field : ''pType'',

  3. title : ''产品类型'',

  4. align : ''center'',

  5. formatter:function(value,row,index){

  6. var value="";

  7. if(row.pType=="1"){

  8. value = "自发货";

  9. }else if(row.pType=="0"){

  10. value = "FBA配送";

  11. }else{

  12. value = row.pType ;

  13. }

  14.  
  15. return value;

  16.  
  17. }

  18. },

 

参考地址https://blog.csdn.net/u013943009/article/details/79459029

总结

以上是小编为你收集整理的bootstrap-table的formatter列参数全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

原文地址:https://blog.csdn.net/weixin_44018338/article/details/100043626

ABP module-zero +AdminLTE+Bootstrap Table+jQuery权限管理系统第十二节--小结,Bootstrap Table之角色管理

ABP module-zero +AdminLTE+Bootstrap Table+jQuery权限管理系统第十二节--小结,Bootstrap Table之角色管理

总结

以上是小编为你收集整理的ABP module-zero +AdminLTE+Bootstrap Table+jQuery权限管理系统第十二节--小结,Bootstrap Table之角色管理全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

bootstarp table引入bootstrap-table-editable.js后报错

bootstarp table引入bootstrap-table-editable.js后报错

bootstrap + bootstrap-table + jquery + bootstrap-paginator

bootstrap + bootstrap-table + jquery + bootstrap-paginator

 

http://127.0.0.1:8848/pangBo/index.html

 

 

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
		 crossorigin="anonymous">
		<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
		 crossorigin="anonymous"></script>
		<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.1/bootstrap-table.min.css">
		<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.1/bootstrap-table.min.js"></script>
		<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.1/locale/bootstrap-table-zh-CN.min.js"></script>
		<script src="js/bootstrap-paginator.min.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div>
			<formrole="search">
				<div>
					<div>
						<div>
							<label>客户编号: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
						<div>
							<label>客户姓名: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
						<div>
							<label>手机号码: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
					</div>
					<div>
						<div>
							<label>客户编号: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
						<div>
							<label>客户编号: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
						<div>
							<label>客户编号: </label>
							<div>
								<input type="text"placeholder="">
							</div>
						</div>
					</div>
					<div>
						<button type="submit">查询</button>
					</div>
				</div>
			</form>
		</div>
		<div>
			<divrole="group" aria-label="...">
				<button type="button" id="btn-one">可撤单</button>
				<button type="button" id="btn-two">已撤单</button>
			</div>
		</div>
		<div id="table-one">
			<table id="table"></table>
			<div>
				<div id="example">
					<ul id="pageLimit"></ul>
				</div>
			</div>
		</div>
		<div id="table-two">
			<table id="table-ta-one"></table>
			<div>
				<div id="example-two">
					<ul id="pageLimit-two"></ul>
				</div>
			</div>
		</div>
		<divid="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div>
				<div>
					<div>
						<button type="button"data-dismiss="modal" aria-hidden="true">&times;</button>
						<divid="myModalLabel">请输入登录密码:</div>
					</div>
					<div>
						<div>
							<input id="input-text" type="text" value=""placeholder="">
						</div>
						<button type="button" id="btn-ok">确定撤单</button>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
<script type="text/javascript">
	function operateFormatter(value, row, index) {
		return [
			''<button type="button"data-toggle="modal" data-target="#myModal">撤单</button>''
		].join('''');
	}
	window.operateEvents = {
		''click .RoleOfdelete'': function(e, value, row, index) {
			console.log(''kkk'');
		}
	};
	$(''#table'').bootstrapTable({
		url: '''', //请求后台的URL(*)
		method: ''GET'', //请求方式(*)
		// toolbar: ''#toolbar'', //工具按钮用哪个容器
		cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
		pagination: false, //是否显示分页(*)
		// pageSize: 10, //每页的记录行数(*)
		// pageNumber: 1, //初始化加载第一页,默认第一页,并记录
		// sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
		uniqueId: "id", //每一行的唯一标识,一般为主键列
		columns: [{
				field: ''id'',
				align: ''center'',
				title: ''交易合同号''
			},
			{
				field: ''ida'',
				align: ''center'',
				title: ''客户编号''
			},
			{
				field: ''idb'',
				align: ''center'',
				title: ''客户姓名''
			},
			{
				field: ''idc'',
				align: ''center'',
				title: ''手机号码''
			},
			{
				field: ''idd'',
				align: ''center'',
				title: ''证件号码''
			},
			{
				field: ''ide'',
				align: ''center'',
				title: ''产品代码''
			},
			{
				field: ''idf'',
				align: ''center'',
				title: ''产品名称''
			},
			{
				field: ''idg'',
				align: ''center'',
				title: ''购买金额''
			},
			{
				field: ''idh'',
				align: ''center'',
				title: ''交易时间''
			},
			{
				field: ''idi'',
				align: ''center'',
				title: ''撤单'',
				events: operateEvents,
				formatter: operateFormatter
			},
		],
		data: [{
				id: 1
			},
			{
				id: 1
			},
			{
				id: 1
			}
		],
		onLoadError: function() {
			showTips("数据加载失败!");
		},

	});
	$(''#table-ta-one'').bootstrapTable({
		url: '''', //请求后台的URL(*)
		method: ''GET'', //请求方式(*)
		// toolbar: ''#toolbar'', //工具按钮用哪个容器
		cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
		pagination: false, //是否显示分页(*)
		// pageSize: 10, //每页的记录行数(*)
		// pageNumber: 1, //初始化加载第一页,默认第一页,并记录
		// sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
		uniqueId: "id", //每一行的唯一标识,一般为主键列
		columns: [{
				field: ''id'',
				align: ''center'',
				title: ''交易合同号''
			},
			{
				field: ''ida'',
				align: ''center'',
				title: ''客户编号''
			},
			{
				field: ''idb'',
				align: ''center'',
				title: ''客户姓名''
			},
			{
				field: ''idc'',
				align: ''center'',
				title: ''手机号码''
			},
			{
				field: ''idd'',
				align: ''center'',
				title: ''证件号码''
			},
			{
				field: ''ide'',
				align: ''center'',
				title: ''产品代码''
			},
			{
				field: ''idf'',
				align: ''center'',
				title: ''产品名称''
			},
			{
				field: ''idg'',
				align: ''center'',
				title: ''购买金额''
			},
			{
				field: ''idh'',
				align: ''center'',
				title: ''交易时间''
			}
		],
		data: [{
				id: 1
			},
			{
				id: 1
			},
			{
				id: 1
			}
		],
		onLoadError: function() {
			showTips("数据加载失败!");
		},

	});
	$(''#btn-one'').click(function() {
		console.log(''kk'');
		$(''#table-one'').show();
		$(''#table-two'').hide();
		$(''#btn-one'').css({
			''background-color'': ''#e6e6e6''
		})
	})
	$(''#btn-two'').click(function() {
		console.log(''kkk'');
		$(''#table-two'').show();
		$(''#table-one'').hide();
		$(''#btn-one'').css({
			''background-color'': ''#FFF''
		})
	})
	$(''#pageLimit'').bootstrapPaginator({
		currentPage: 1, //当前的请求页面。
		totalPages: 100, //一共多少页。
		size: "normal", //应该是页眉的大小。
		bootstrapMajorVersion: 3, //bootstrap的版本要求。
		alignment: "right",
		numberOfPages: 5, //一页列出多少数据。
		itemTexts: function(type, page, current) { //如下的代码是将页眉显示的中文显示我们自定义的中文。
			switch (type) {
				case "first":
					return "首页";
				case "prev":
					return "上一页";
				case "next":
					return "下一页";
				case "last":
					return "末页";
				case "page":
					return page;
			}
		}
	});
	$(''#pageLimit-two'').bootstrapPaginator({
		currentPage: 1, //当前的请求页面。
		totalPages: 100, //一共多少页。
		size: "normal", //应该是页眉的大小。
		bootstrapMajorVersion: 3, //bootstrap的版本要求。
		alignment: "right",
		numberOfPages: 5, //一页列出多少数据。
		itemTexts: function(type, page, current) { //如下的代码是将页眉显示的中文显示我们自定义的中文。
			switch (type) {
				case "first":
					return "首页";
				case "prev":
					return "上一页";
				case "next":
					return "下一页";
				case "last":
					return "末页";
				case "page":
					return page;
			}
		}
	});
	$(''#btn-ok'').click(function() {
		var inputContent = $(''#input-text'').val();
		if (inputContent == '''') {
			alert(''密码不能为空 !'');
		}
		console.log(inputContent);
	})
</script>

 

Bootstrap 2或Bootstrap 3 for IE 7 Performance Wise

Bootstrap 2或Bootstrap 3 for IE 7 Performance Wise

虽然我知道SO不喜欢A vs B主题听到我的声音.

Bootstrap 3刚刚发布,无数改进.一个潜在的交易破坏者是降低IE 7的兼容性.对于满足企业用户的网站来说,这不幸是不实际的,因为在一个特定的用例中大概是10%的市场.

所以支持IE7是一个必须的,一个人会认为只是选择坚持使用Bootstrap 2.但是,使用这个https://github.com/coliff/bootstrap-ie7可以轻松添加IE7支持,同时保持Bootstrap 3的所有好处.

一个问题是您必须使用Boxsizing.htc polyfill for IE 7用户(https://github.com/Schepp/box-sizing-polyfill)

所以我的问题是更好地坚持使用Bootstrap 2或者切换到Bootstrap 3.0 with Boxsizing.htc? B3的.htc对于10%的IE7用户而言比B2更慢,但如果几乎不明显(特别是如果服务器是缓存),这对90%的其余部分的好处是值得的.

如果知道的话,我猜测我可以测试的下一件事是使用.htc演示站点安装默认的B2和B3,并比较IE7的速度.

PS如果有一个更好的polyfill添加盒子化IE7比上面列出的性能明智让我知道.

解决方法

我在Bootstrap 3 / IE7中面临着类似的困境,但是却出现了不同的解决方案.像Zout一样,我无法让修补程序工作,所以我写了一个不需要polyfill的补丁.

它可以通过返回到没有填充的流体柱的Bootstrap 2型网格系统和从第二列开始的左边距来起作用.在IE7与Bootstrap 3,我的网站看起来完美.

我已经测试了(它的工作原理)与Bootstrap的大部分组件.它还包括针对IE布局错误和其他奇怪行为的修复.

我刚刚把它放在Github上.希望有帮助:

https://github.com/LPology/Bootstrap-IE7Fix

我们今天的关于bootstrap-table的formatter列参数bootstraptable formatter的分享就到这里,谢谢您的阅读,如果想了解更多关于ABP module-zero +AdminLTE+Bootstrap Table+jQuery权限管理系统第十二节--小结,Bootstrap Table之角色管理、bootstarp table引入bootstrap-table-editable.js后报错、bootstrap + bootstrap-table + jquery + bootstrap-paginator、Bootstrap 2或Bootstrap 3 for IE 7 Performance Wise的相关信息,可以在本站进行搜索。

本文标签: