json-rules-filter 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-rules-filter",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "para crear reglas avanzadas de filtrado sobre datasets JSON de forma dinámica y visual.",
5
5
  "main": "src/jquery.jsonRulesFilter.js",
6
6
  "scripts": {
@@ -156,6 +156,13 @@
156
156
  </div>
157
157
  </div>`;
158
158
  this.$contenedor.append(template);
159
+ },
160
+
161
+ // Event delegation and listeners
162
+ bindEvents: function () {
163
+ const self = this;
164
+
165
+ //Dropdown events
159
166
  const $dropdown = this.$contenedor.find('.dropdown-toggle');
160
167
 
161
168
  if (this.settings.bsVersion === 4) {
@@ -172,21 +179,19 @@
172
179
  }
173
180
  });
174
181
 
182
+ //Dropdown
175
183
  $dropdown.on('click', function (e) {
176
184
  e.stopPropagation();
185
+ const $conatiner_dropdown = $(this).parent().find('.dropdown-rules-columns');
186
+ $(this).dropdown($conatiner_dropdown.hasClass('show') ? "hide" : "show");
177
187
  });
178
-
179
188
  }
180
- },
181
-
182
- // Event delegation and listeners
183
- bindEvents: function () {
184
- const self = this;
185
189
 
186
190
  // Add new rule row
187
191
  this.$contenedor.find(".dropdown-rules-item").on("click", function (e) {
188
192
  e.preventDefault();
189
193
  self.addRuleRow($(this).data("column-type"), $(this).data("column-data"), $(this).data("column-name"));
194
+ $dropdown.dropdown("hide");
190
195
  });
191
196
 
192
197
  // Clear all rules
@@ -258,6 +263,7 @@
258
263
 
259
264
  $select.select2({
260
265
  width: '100%',
266
+ dropdownParent: this.$contenedor, // Parent render
261
267
  escapeMarkup: function (markup) { return markup; }, // Allow HTML rendering in badges
262
268
  templateSelection: render,
263
269
  templateResult: render,