Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.9 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. Ext.ns('Ext.ux.form');
  16. Ext.ux.form.SearchField = Ext.extend(Ext.form.TwinTriggerField, {
  17. initComponent : function(){
  18. Ext.ux.form.SearchField.superclass.initComponent.call(this);
  19. this.on('specialkey', function(f, e){
  20. if(e.getKey() == e.ENTER){
  21. this.onTrigger2Click();
  22. }
  23. }, this);
  24. },
  25. validationEvent:false,
  26. validateOnBlur:false,
  27. trigger1Class:'x-form-clear-trigger',
  28. trigger2Class:'x-form-search-trigger',
  29. hideTrigger1:true,
  30. width:180,
  31. hasSearch : false,
  32. paramName : 'query',
  33. onTrigger1Click : function(){
  34. if(this.hasSearch){
  35. this.el.dom.value = '';
  36. var o = {start: 0};
  37. this.store.baseParams = this.store.baseParams || {};
  38. this.store.baseParams[this.paramName] = '';
  39. this.store.reload({params:o});
  40. this.triggers[0].hide();
  41. this.hasSearch = false;
  42. }
  43. },
  44. onTrigger2Click : function(){
  45. var v = this.getRawValue();
  46. if(v.length < 1){
  47. this.onTrigger1Click();
  48. return;
  49. }
  50. var o = {start: 0};
  51. this.store.baseParams = this.store.baseParams || {};
  52. this.store.baseParams[this.paramName] = v;
  53. this.store.reload({params:o});
  54. this.hasSearch = true;
  55. this.triggers[0].show();
  56. }
  57. });</pre>
  58. </body>
  59. </html>