mirror of https://github.com/layui/layui
优化 transfer 的搜索默认不区分大小写
parent
cfd6f0cb5f
commit
adb53a1ee1
|
@ -427,14 +427,22 @@ layui.define(['laytpl', 'form'], function(exports){
|
||||||
|
|
||||||
//搜索
|
//搜索
|
||||||
that.laySearch.find('input').on('keyup', function(){
|
that.laySearch.find('input').on('keyup', function(){
|
||||||
var value = this.value
|
var value = this.value;
|
||||||
,thisDataElem = $(this).parents('.'+ ELEM_SEARCH).eq(0).siblings('.'+ ELEM_DATA)
|
var thisDataElem = $(this).parents('.'+ ELEM_SEARCH).eq(0).siblings('.'+ ELEM_DATA);
|
||||||
,thisListElem = thisDataElem.children('li');
|
var thisListElem = thisDataElem.children('li');
|
||||||
|
|
||||||
thisListElem.each(function(){
|
thisListElem.each(function(){
|
||||||
var thisList = $(this)
|
var thisList = $(this);
|
||||||
,thisElemCheckbox = thisList.find('input[type="checkbox"]')
|
var thisElemCheckbox = thisList.find('input[type="checkbox"]');
|
||||||
,isMatch = thisElemCheckbox[0].title.indexOf(value) !== -1;
|
var title = thisElemCheckbox[0].title;
|
||||||
|
|
||||||
|
// 是否区分大小写
|
||||||
|
if(options.showSearch !== 'cs'){
|
||||||
|
title = title.toLowerCase();
|
||||||
|
value = value.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
var isMatch = title.indexOf(value) !== -1;
|
||||||
|
|
||||||
thisList[isMatch ? 'removeClass': 'addClass'](HIDE);
|
thisList[isMatch ? 'removeClass': 'addClass'](HIDE);
|
||||||
thisElemCheckbox.data('hide', isMatch ? false : true);
|
thisElemCheckbox.data('hide', isMatch ? false : true);
|
||||||
|
|
Loading…
Reference in New Issue