customformat.html 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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. <div class="demo-info" style="margin-bottom:10px">
  15. <div class="demo-tip icon-tip"></div>
  16. <div>This sample shows how to custom the format of list item.</div>
  17. </div>
  18. <input class="easyui-combobox" name="language" 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. ">
  27. <script type="text/javascript">
  28. function formatItem(row){
  29. var s = '<span style="font-weight:bold">' + row.text + '</span><br/>' +
  30. '<span style="color:#888">' + row.desc + '</span>';
  31. return s;
  32. }
  33. </script>
  34. </body>
  35. </html>