GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix missing first ajax request with filter cookies · jb091/bootstrap-table@10e04fd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/extensions/cookie
    • bootstrap-table-cookie.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/extensions/cookie/bootstrap-table-cookie.js‎

Copy file name to clipboardExpand all lines: src/extensions/cookie/bootstrap-table-cookie.js
+7-32Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@
170170
var parsedCookieFilters = JSON.parse(getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, cookieIds.filterControl));
171171

172172
if (!bootstrapTable.options.filterControlValuesLoaded && parsedCookieFilters) {
173-
bootstrapTable.options.filterControlValuesLoaded = true;
174173

175174
var cachedFilters = {},
176175
header = getCurrentHeader(bootstrapTable),
@@ -193,7 +192,8 @@
193192
});
194193

195194
bootstrapTable.initColumnSearch(cachedFilters);
196-
bootstrapTable.refresh();
195+
bootstrapTable.options.filterControlValuesLoaded = true;
196+
bootstrapTable.initServer();
197197
}
198198
}, 250);
199199
};
@@ -241,7 +241,6 @@
241241
_onSearch = BootstrapTable.prototype.onSearch;
242242

243243
BootstrapTable.prototype.init = function () {
244-
var timeoutId = 0;
245244
this.options.filterControls = [];
246245
this.options.filterControlValuesLoaded = false;
247246

@@ -276,36 +275,12 @@
276275
};
277276

278277
BootstrapTable.prototype.initServer = function () {
279-
var bootstrapTable = this,
280-
selectsWithoutDefaults = [],
281-
282-
columnHasSelectControl = function (column) {
283-
return column.filterControl && column.filterControl === 'select';
284-
},
285-
286-
columnHasDefaultSelectValues = function (column) {
287-
return column.filterData && column.filterData !== 'column';
288-
},
289-
290-
cookiesPresent = function() {
291-
var cookie = JSON.parse(getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, cookieIds.filterControl));
292-
return bootstrapTable.options.cookie && cookie;
293-
};
294-
295-
selectsWithoutDefaults = $.grep(bootstrapTable.columns, function(column) {
296-
return columnHasSelectControl(column) && !columnHasDefaultSelectValues(column);
297-
});
298-
299-
// reset variable to original initServer function, so that future calls to initServer
300-
// use the original function from this point on.
301-
BootstrapTable.prototype.initServer = _initServer;
302-
303-
// early return if we don't need to populate any select values with cookie values
304-
if (this.options.filterControl && cookiesPresent() && selectsWithoutDefaults.length === 0) {
305-
return;
278+
var bootstrapTable = this;
279+
if (bootstrapTable.options.cookie && bootstrapTable.options.filterControl && !bootstrapTable.options.filterControlValuesLoaded) {
280+
var cookie = JSON.parse(getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, cookieIds.filterControl));
281+
if (cookie)
282+
return;
306283
}
307-
308-
// call BootstrapTable.prototype.initServer
309284
_initServer.apply(this, Array.prototype.slice.apply(arguments));
310285
};
311286

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.