若依框架清空select2选择

在封装好的reset方法里加一行
$("#" + currentId).find('select').val('').trigger('change');
就可以了
reset: function(formId, tableId) {
table.set(tableId);
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
$("#" + currentId)[0].reset();
//这里-----
$("#" + currentId).find('select').val('').trigger('change');
//=========
if (table.options.type == table_type.bootstrapTable) {
if($.common.isEmpty(tableId)){
$("#" + table.options.id).bootstrapTable('refresh');
} else{
$("#" + tableId).bootstrapTable('refresh');
}
} else if (table.options.type == table_type.bootstrapTreeTable) {
if($.common.isEmpty(tableId)){
$("#" + table.options.id).bootstrapTreeTable('refresh', []);
} else{
$("#" + tableId).bootstrapTreeTable('refresh', []);
}
}
},
原文地址:https://www.cnblogs.com/michaelcnblogs/p/15552502.html