Bootstrap 开关状态不工作?
Bootstrap Switch status not working?
S 状态不适用于数据表:我在 html 字符串中有 ses 已检查和未检查 DB 值。它不适用于其他部分,仅显示 active/checked s 但未显示未检查的 状态...请检查我的情况是否有误....尽快.....问候....
$.each(checkUser, function(index, act){
console.log(act.accountEnabled);
**if(act.accountEnabled){
enableDisable = " <input id='switch-user' name='switch-user' type='checkbox' checked data-size='mini' data-on-label='Enable' data-off-label='Disable'>";
} else{
enableDisable = " <input id='switch-user' name='switch-user' type='checkbox' data-size='mini' data-on-label='Enable' data-off-label='Disable'>";**
}
console.log(enableDisable);
});
var userData = data.users;
var dataSet = [];
$.each(userData, function(index, user){
dataSet.push([
user.name,
user.userId,
user.creationTime,
user.accountEnabled,
user.roleName,
userActions,
enableDisable
]);
});
var oTable = $('table#user-datatable').dataTable( {
"data": dataSet,
"bFilter": false,
"bLengthChange": false,
"bPaginate": false,
"bInfo": false,
"columnDefs": [
{ "targets": 5, "orderable": false, "width": "180px" },
{"targets": 6, "orderable": false, "width": "60px" }
],
"tableTools": {
"sRowSelect": "single"
},
"columns": [
{ "title": "Name" },
{ "title": "UserId" },
{ "title": "CreationTime"},
{ "title": "Account Enabled" },
{ "title": "Role" },
{ "title": "Action"},
{"title" : "Enable/Disable"}
],
"fnInitComplete" : function(settings, json){
$("input#switch-user").bootstrapSwitch();
}
});
var userData = data.users;
var dataSet = [];
$.each(userData, function(index, user){
if(user.accountEnabled){
enableDisable = " <input id='switch-user' name='switch-user' type='checkbox' checked data-size='mini' data-on-label='Enable' data-off-label='Disable'>";
}
else{
enableDisable = " <input id='switch-user' name='switch-user' type='checkbox' data-size='mini' data-on-label='Enable' data-off-label='Disable'>";**
}
dataSet.push([
user.name,
user.userId,
user.creationTime,
user.accountEnabled,
user.roleName,
userActions,
enableDisable
]);
});
S 状态不适用于数据表:我在 html 字符串中有 ses 已检查和未检查 DB 值。它不适用于其他部分,仅显示 active/checked s 但未显示未检查的 状态...请检查我的情况是否有误....尽快.....问候....
$.each(checkUser, function(index, act){
console.log(act.accountEnabled);
**if(act.accountEnabled){
enableDisable = " <input id='switch-user' name='switch-user' type='checkbox' checked data-size='mini' data-on-label='Enable' data-off-label='Disable'>";
} else{
enableDisable = " <input id='switch-user' name='switch-user' type='checkbox' data-size='mini' data-on-label='Enable' data-off-label='Disable'>";**
}
console.log(enableDisable);
});
var userData = data.users;
var dataSet = [];
$.each(userData, function(index, user){
dataSet.push([
user.name,
user.userId,
user.creationTime,
user.accountEnabled,
user.roleName,
userActions,
enableDisable
]);
});
var oTable = $('table#user-datatable').dataTable( {
"data": dataSet,
"bFilter": false,
"bLengthChange": false,
"bPaginate": false,
"bInfo": false,
"columnDefs": [
{ "targets": 5, "orderable": false, "width": "180px" },
{"targets": 6, "orderable": false, "width": "60px" }
],
"tableTools": {
"sRowSelect": "single"
},
"columns": [
{ "title": "Name" },
{ "title": "UserId" },
{ "title": "CreationTime"},
{ "title": "Account Enabled" },
{ "title": "Role" },
{ "title": "Action"},
{"title" : "Enable/Disable"}
],
"fnInitComplete" : function(settings, json){
$("input#switch-user").bootstrapSwitch();
}
});
var userData = data.users;
var dataSet = [];
$.each(userData, function(index, user){
if(user.accountEnabled){
enableDisable = " <input id='switch-user' name='switch-user' type='checkbox' checked data-size='mini' data-on-label='Enable' data-off-label='Disable'>";
}
else{
enableDisable = " <input id='switch-user' name='switch-user' type='checkbox' data-size='mini' data-on-label='Enable' data-off-label='Disable'>";**
}
dataSet.push([
user.name,
user.userId,
user.creationTime,
user.accountEnabled,
user.roleName,
userActions,
enableDisable
]);
});