EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: zh_CN on April 12, 2014, 04:51:27 AM



Title: (Resolved)Is combobox not supported Chinese retrieval?(combobox不支持对中文的检索过滤吗?)
Post by: zh_CN on April 12, 2014, 04:51:27 AM
Hi all!
  I use combobox like this:
Code:
...
<select class="easyui-combobox" name="sex">
              <option value="1">男</option>
              <option value="0">女</option>
               <option value="AL">Alabama</option>
               <option value="AK">Alaska</option>
               <option value="AZ">Arizona</option>
               <option value="AR">Arkansas</option>
</select>
...

When i input the option "男",i't doesn‘t  filter others!
But i input the english option like "ala", it work fine!

See the attachment:



Title: Re: Is combobox not supported Chinese retrieval?(combobox不支持对中文的检索过滤吗?)
Post by: hjzhbb7758 on April 12, 2014, 11:01:26 AM
支持中文


Title: Re: Is combobox not supported Chinese retrieval?(combobox不支持对中文的检索过滤吗?)
Post by: zh_CN on April 12, 2014, 06:04:19 PM
支持中文

我这不起作用,need special setting?


Title: Re: Is combobox not supported Chinese retrieval?(combobox不支持对中文的检索过滤吗?)
Post by: zh_CN on April 12, 2014, 09:20:04 PM
I know, must be next letter that can filter others;


Title: Re: (Resolved)Is combobox not supported Chinese retrieval?(combobox不支持对中文的检索过滤吗?)
Post by: iamjxc on April 14, 2014, 12:28:56 AM
中文输入, 是paste进去的, 不能触发按键事件. 所以你得手工按键才能触发过滤
中文过滤还是用首字母过滤的方案比较好


Title: Re: (Resolved)Is combobox not supported Chinese retrieval?(combobox不支持对中文的检索过滤吗?)
Post by: zh_CN on April 14, 2014, 06:42:46 PM
中文输入, 是paste进去的, 不能触发按键事件. 所以你得手工按键才能触发过滤
中文过滤还是用首字母过滤的方案比较好


是的,用首字母,你那有实现吗?


Title: Re: (Resolved)Is combobox not supported Chinese retrieval?(combobox不支持对中文的检索过滤吗?)
Post by: iamjxc on April 15, 2014, 06:54:15 PM
给combobox指定filter函数, 拼音检索见附件

   function filterComboboxData(input, row) {
      // 清空内容, 则不过滤
      if (input == "") return true;
      
      input = input.toUpperCase();
      
      // 先判断显示值
      var opts = $(this).combobox('options');
      var text = row[opts.textField].toUpperCase();
      if (text.indexOf(input) >= 0) {
         return true;
      }
      
      // 优先用top里共享的拼音检索函数(避免每个页面都加载拼音js)
      var spell = top.getFirstSpellLetter;
      if (!spell) spell = getFirstSpellLetter;
      if (spell) {
         var letter = spell(text);
         if (letter.indexOf(input) >= 0) {
            return true;
         }
         return false;
      }

      // 默认不过滤
      return true;
   }
   


Title: Re: (Resolved)Is combobox not supported Chinese retrieval?(combobox不支持对中文的检索过滤吗?)
Post by: zh_CN on April 16, 2014, 07:55:44 PM
给combobox指定filter函数, 拼音检索见附件

   function filterComboboxData(input, row) {
      // 清空内容, 则不过滤
      if (input == "") return true;
      
      input = input.toUpperCase();
      
      // 先判断显示值
      var opts = $(this).combobox('options');
      var text = row[opts.textField].toUpperCase();
      if (text.indexOf(input) >= 0) {
         return true;
      }
      
      // 优先用top里共享的拼音检索函数(避免每个页面都加载拼音js)
      var spell = top.getFirstSpellLetter;
      if (!spell) spell = getFirstSpellLetter;
      if (spell) {
         var letter = spell(text);
         if (letter.indexOf(input) >= 0) {
            return true;
         }
         return false;
      }

      // 默认不过滤
      return true;
   }
   

我先学习下,实在感谢!

能留个联系方式吗,可以的话,可以单独发我邮件

Thanks very much!