ITeye博客

combobox--4

youyang_java · 2014-06-17 11:17 · jquery-easyui-1.2.6 · Web前端 · Markdown


 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
 
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
   
    <!-- easyui的样式 -->
    <link rel="stylesheet" type="text/css" href="../jslib/jquery-easyui-1.3.1/themes/default/easyui.css">
    <!-- 小图标的样式 -->
    <link rel="stylesheet" type="text/css" href="../jslib/jquery-easyui-1.3.1/themes/icon.css">
   
    <script type="text/javascript" src="../jslib/jquery-easyui-1.3.1/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../jslib/jquery-easyui-1.3.1/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../jslib/jquery-easyui-1.3.1/locale/easyui-lang-zh_CN.js"></script>
 
 <script type="text/javascript">
 
  var d = [{  
        "id":1,  
        "text":"text1" 
    },{  
        "id":2,  
        "text":"text2" 
    },{  
        "id":3,  
        "text":"text3",  
        "selected":true 
    },{  
        "id":4,  
        "text":"Text4" 
    },{  
        "id":5,  
        "text":"text5" 
    }] ;
  
  
  $(function(){
   $('#cc').combobox({  
       data:d,  
       valueField:'id',  
       textField:'text',
       //本地数据过滤
       filter: function(q, row){
        //找到匹配的字母
     var opts = $(this).combobox('options');
     return row[opts.textField].toUpperCase().indexOf(q.toUpperCase()) >= 0;
    },
    formatter: function(row){
     var opts = $(this).combobox('options');
     return row[opts.textField]+'xxxx';
    }
       
          
   });
  });
 </script>
 
  </head>
   
  <body> 
    <input id="cc" /> 
  </body>
</html>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。