bootstrapSwitch开关组件在模态框加载问题
发布时间:2020-12-17 21:28:28 所属栏目:安全 来源:网络整理
导读://先加载出模态框 $(‘#controlModal‘).modal(‘show‘); //再对模态框内的开关组件初始化(动态开关状态) //必须使用 .on(‘shown.bs.modal‘,function(){}); (‘#controlModal‘).on(‘shown.bs.modal‘,function () { //移动报警的开关switch $("#moveS
//先加载出模态框 //移动报警的开关switch $("#moveSwitch").bootstrapSwitch({ onText: "开",? ? ?// 设置ON文本 ? offText: "关",? ?// 设置OFF文本 ? onColor: "success",// 设置ON文本颜色 ? ? (info/success/warning/danger/primary) ? offColor: "danger",?// 设置OFF文本颜色 ? ? ? ?(info/success/warning/danger/primary) ? size: "small",? ?// 设置控件大小,从小到大 ?(mini/small/normal/large) ? handleWidth: "35",//设置控件宽度 // 当开关状态改变时触发 ? onSwitchChange: function (event,state) { var isornoId = event.target.id;//input的id if (state == true) { //开 <!--7:移位报警开; var sCmdV = 7; var gpsNo = $("#gpsNo").val(); $.post("/system/vehicle/sendCmd?gpsNo=" + gpsNo + "&cmd=" + sCmdV,function (data) { if (data) { // toastr.success("发送成功"); $(‘#vehicleInfoTab‘).bootstrapTable(‘refresh‘); } else { toastr.error("发送失败"); } }); } else { //关 8:移位报警关--> var sCmdV = 8; var gpsNo = $("#gpsNo").val(); $.post("/system/vehicle/sendCmd?gpsNo=" + gpsNo + "&cmd=" + sCmdV,function (data) { if (data) { // toastr.success("发送成功"); $(‘#vehicleInfoTab‘).bootstrapTable(‘refresh‘); } else { toastr.error("发送失败"); } }); } } }).bootstrapSwitch(‘state‘,rows.move);//bootstrapSwitch开关初始化属性state , 一定要放在最后}); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |