ComboBox.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. Ext.define("school.override.form.field.ComboBox", {
  2. override: "Ext.form.field.ComboBox",
  3. clearable: false,
  4. config: {
  5. triggers: {
  6. clear: {
  7. weight: -1,
  8. cls: 'fa-times',
  9. hidden: true,
  10. onFieldFocus: function() {
  11. if(this.field.clearable) {
  12. this.setHidden(false);
  13. }
  14. },
  15. onFieldBlur: function() {
  16. if(this.field.clearable) {
  17. this.setHidden(true);
  18. }
  19. },
  20. handler: function() {
  21. if(this.clearable) {
  22. this.setValue(null)
  23. this.triggers.clear.setHidden(true)
  24. this.fireEvent('clear', this);
  25. }
  26. }
  27. },
  28. picker: {
  29. handler: 'onTriggerClick',
  30. scope: 'this',
  31. focusOnMousedown: true
  32. }
  33. }
  34. },
  35. });