1
0

forms_lists.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. *
  5. * @defgroup UnaStudio UNA Studio
  6. * @{
  7. */
  8. function BxDolStudioFormsPreLists(oOptions) {
  9. this._iSearchTimeoutId = false;
  10. this.sActionsUrl = oOptions.sActionUrl;
  11. this.sPageUrl = oOptions.sPageUrl;
  12. this.sObjNameGrid = oOptions.sObjNameGrid;
  13. this.sObjName = oOptions.sObjName == undefined ? 'oBxDolStudioFormsLists' : oOptions.sObjName;
  14. this.sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
  15. this.iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  16. this.sParamsDivider = oOptions.sParamsDivider == undefined ? '#-#' : oOptions.sParamsDivider;
  17. this.sTextSearchInput = oOptions.sTextSearchInput == undefined ? '' : oOptions.sTextSearchInput;
  18. var $this = this;
  19. $(document).ready(function() {
  20. $('#bx-grid-search-' + $this.sObjNameGrid).off('keyup focusout').bind({
  21. keyup: function (e) {
  22. $this.onChangeFilter();
  23. },
  24. focusout: function (e) {
  25. if (0 == this.value.length)
  26. this.value = $this.sTextSearchInput;
  27. $this.onChangeFilter();
  28. }
  29. });
  30. });
  31. }
  32. BxDolStudioFormsPreLists.prototype.onChangeFilter = function() {
  33. var $this = this;
  34. var sValueModule = $('#bx-grid-module-' + this.sObjNameGrid).val();
  35. var sValueSearch = $('#bx-grid-search-' + this.sObjNameGrid).val();
  36. if(sValueSearch == this.sTextSearchInput)
  37. sValueSearch = '';
  38. clearTimeout($this._iSearchTimeoutId);
  39. $this._iSearchTimeoutId = setTimeout(function () {
  40. glGrids[$this.sObjNameGrid].setFilter(sValueModule + $this.sParamsDivider + sValueSearch, true);
  41. }, 500);
  42. };
  43. /** @} */