Files
ulthon_admin/extend/base/admin/view/notice/subscribe.js

17 lines
572 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$(function(){
// 提交前补齐矩阵:layui 只序列化勾选的开关,
// 这里把全部未禁用开关按当前状态补齐为 1/0,保证逐格显式 upsert
function buildMatrix(dataField) {
$('#subscribe-matrix input[type="checkbox"][name^="matrix["]').each(function () {
var $input = $(this);
if ($input.prop('disabled')) {
return;
}
dataField[$input.attr('name')] = $input.prop('checked') ? 1 : 0;
});
return dataField;
}
ua.listen(buildMatrix);
})