Guest User

Untitled

a guest
Feb 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. $.widget("custom.leadsForConnections", {
  2. _create: function () {
  3. this.wrapper = $("<span>")
  4. .addClass("custom-combobox")
  5. .insertAfter(this.element);
  6.  
  7. this.element.hide();
  8. this._createAutocomplete();
  9. this.element.bind("change", function () {
  10. this.input.val($(select).find("option:selected").text());
  11. });
  12. },
  13. _createAutocomplete: function () {
  14. var selected = this.element.children(":selected"),
  15. value = selected.val() ? selected.text() : "";
  16. this.input = $("<input>")
  17. .appendTo(this.wrapper)
  18. .val(value)
  19. .attr("title", "")
  20. .addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left")
  21. .autocomplete({
  22. delay: 600,
  23. minLength: 1,
  24. source: $.proxy(this, "_source")
  25. })
  26. .tooltip({
  27. classes: {
  28. "ui-tooltip": "ui-state-highlight"
  29. }
  30. }).focus();
  31.  
  32. this._on(this.input, {
  33. autocompleteselect: function (event, ui) {
  34. ui.item.option.selected = true;
  35. this._trigger("select", event, {
  36. item: ui.item.option
  37. });
  38. },
  39. });
  40. },
  41.  
  42. ...
  43.  
  44. });
  45.  
  46. <div class="g-hidden">
  47. <div class="box-modal" id="add_connection_modal">
  48. <div class="box-modal_close arcticmodal-close"><img id="closePopupImage"
  49. src="/images/icons/popup_icon_close.png"></div>
  50. <div class="label">{'TEXT_NAME'|tr}:
  51. </div>
  52. <div class="ui-widget spn">
  53. <select id="leadsForConnections" style="width:150px;">
  54. <option value="">Select one...</option>
  55. </select>
  56. </div>
  57. <span class="error_message" id="connection_error">Error</span>
  58. <span class="success_message" id="connection_success">Success</span>
  59. </div>
  60. </div>
Add Comment
Please, Sign In to add comment