帝王谷资源网 Design By www.wdxyy.com
学习bootstrapTable 一直没有找到 单选框的选定的和取值的教程,今天写一个.作为笔记
1. 效果图: 点击 bootstrapTable 单选的按钮, 选中该列, 取到该列的所有值.
2. js 代码 : bootstrapTable 初始化
a. 注意:
singleSelect : true, // 单选checkbox columns : [ { checkbox: true } ] // bootstrapTable 显示单选checkbox 列
$().ready(function() { // bootstrapTable 表格数据初始化 var table = $('#item_info_table').bootstrapTable({ url : '<c:url value='/item/entry/main_info/list_data'/>', method : 'POST', // GET uniqueId : 'id', // 绑定ID toolbar : '#item_info_toolbar', // 搜索框绑定 search : true, // 搜索框 pagination : true, // 显示页码等信息 singleSelect : true, // 单选checkbox showRefresh : true, // 显示刷新按钮 showColumns : true, // 选择显示的列 pageSize : pageSize, // 当前分页值 pageList : pageList, // 分页选页 dataType : dataType, // JSON sidePagination : sidePagination, // 服务端请求 buttonsAlign : buttonsAlign, // 刷新,显示列按钮位置 toolbarAlign : toolbarAlign, // 搜索框位置 columns : [ { checkbox: true }, { title : '项目序号', field : 'itemNum', align : 'center', formatter:function(value,row,index){ var url = ''; if (isSingleItem(value)) url = '<a href="#" mce_href="#" onclick="single_item_edit_fun(\'' + row.infoId + '\')">' + row.itemNum + '</a> '; if (isJoinItem(value)) url = '<a href="#" mce_href="#" onclick="join_item_edit_fun(\'' + row.infoId + '\')">' + row.itemNum + '</a> '; return url; } }, { title : '项目名称', field : 'itemName', align : 'center' } ] }); /********** bootstrapTable toolbar 按钮事件 *********/ // [新增] 按钮点击事件 $('#item_info_btn_add').click(function(){ $('#item_info_modal').modal('show'); }); // [项目立项] 按钮点击事件 $('#item_info_btn_do').click(function(){ var selectContent = table.bootstrapTable('getSelections')[0]; if(typeof(selectContent) == 'undefined') { toastr.warning('请选择一列数据!'); return false; }else{ console.info(selectContent); $('#item_project_modal').modal('show'); // 项目立项面板 } }); });
3. bootstrapTable url : '<c:url value='/item/entry/main_info/list_data'/>',
后台json数据
注意. 第一个图片中的 chrome F12 中的 Object 就是selectContent =table.bootstrapTable('getSelections')[0] 中的数据了 这样我们就能取到 bootstrap 单选框 选择 一行的 数据.
{ "offset":10, "rows": [ { "infoId":"main_info_1111", "itemName":"AAA项目组", "itemNum":"JXY160909011S" }, { "infoId":"main_info_2222", "itemName":"BBB项目组", "itemNum":"JXY160909012F" } ], "total":10 }
以上所述是小编给大家介绍的BootStrapTable 单选及取值的实现方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
2024年10月24日
2024年10月24日
- 群星2013-青春缤纷辑压箱宝大公开3CD2[新加坡限量版][WAV整轨]
- 林育群.2013-BalladShow(日本版)【环球】【WAV+CUE】
- 陈加洛.1992-痛到感觉不到【宝丽金】【WAV+CUE】
- 群星.2023-宿命之敌电视剧原声带【韶愔音乐】【FLAC分轨】
- 東京事変-大発見[FLAC+CUE]
- 椎名林檎-三文ゴシップ[FLAC+CUE]
- 2024年08月04日
- 裘德《裘德「最后的水族馆」演唱会LIVE》[320K/MP3][228.89MB]
- 裘德《裘德「最后的水族馆」演唱会LIVE》[24bit 48kHz][FLAC/分轨][2.08G]
- 基因三重奏《如果你什么都不说 音乐会现场录音》[320K/MP3][145.37MB]
- 孟庭苇.1996-月亮说话(2020环球24KGOLD限量版)【上华】【WAV+CUE】
- 群星.1997-新艺宝优质音响系列·国语精选监听版【新艺宝】【WAV+CUE】
- 阿桑.2005-寂寞在唱歌(星外星引进版)【华研国际】【WAV+CUE】
- 基因三重奏《如果你什么都不说 音乐会现场录音》[FLAC/分轨][287.43MB]
- 蔡题谦《我爱你,却依然要看你走》[320K/MP3][88.65MB]