customformat.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Custom Format in ComboBox - jQuery EasyUI Demo</title>
  6. <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="../demo.css">
  9. <script type="text/javascript" src="../../jquery.min.js"></script>
  10. <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
  11. </head>
  12. <body>
  13. <h2>Custom Format in ComboBox</h2>
  14. <p>This sample shows how to custom the format of list item.</p>
  15. <div style="margin:20px 0"></div>
  16. <div class="easyui-panel" style="width:100%;max-width:400px;padding:30px 60px;">
  17. <div style="margin-bottom:20px">
  18. <input class="easyui-combobox" name="language" style="width:100%;" data-options="
  19. url: 'combobox_data1.json',
  20. method: 'get',
  21. valueField: 'id',
  22. textField: 'text',
  23. panelWidth: 350,
  24. panelHeight: 'auto',
  25. formatter: formatItem,
  26. label: 'Language:',
  27. labelPosition: 'top'
  28. ">
  29. </div>
  30. </div>
  31. <script type="text/javascript">
  32. function formatItem(row){
  33. var s = '<span style="font-weight:bold">' + row.text + '</span><br/>' +
  34. '<span style="color:#888">' + row.desc + '</span>';
  35. return s;
  36. }
  37. </script>
  38. </body>
  39. </html>