Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions dist/jquery.bootgrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,12 +728,15 @@ function renderSearchField()
var that = this,
tpl = this.options.templates,
timer = null, // fast keyup detection
currentValue = "",
currentValue = this.searchPhrase,
searchFieldSelector = getCssSelector(css.searchField),
search = $(tpl.search.resolve(getParams.call(this))),
searchField = (search.is(searchFieldSelector)) ? search :
search.find(searchFieldSelector);

// populate search field if initial search phrase provided
$(searchField).val(currentValue);

searchField.on("keyup" + namespace, function (e)
{
e.stopPropagation();
Expand Down Expand Up @@ -1000,7 +1003,7 @@ var Grid = function(element, options)
this.converter = null; // The converter for the column that is marked as identifier
this.rowCount = ($.isArray(rowCount)) ? rowCount[0] : rowCount;
this.rows = [];
this.searchPhrase = "";
this.searchPhrase = this.options.initialSearchPhrase || "";
this.selectedRows = [];
this.sortDictionary = {};
this.total = 0;
Expand Down
5 changes: 4 additions & 1 deletion src/internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,15 @@ function renderSearchField()
var that = this,
tpl = this.options.templates,
timer = null, // fast keyup detection
currentValue = "",
currentValue = this.searchPhrase,
searchFieldSelector = getCssSelector(css.searchField),
search = $(tpl.search.resolve(getParams.call(this))),
searchField = (search.is(searchFieldSelector)) ? search :
search.find(searchFieldSelector);

// populate search field if initial search phrase provided
$(searchField).val(currentValue);

searchField.on("keyup" + namespace, function (e)
{
e.stopPropagation();
Expand Down
2 changes: 1 addition & 1 deletion src/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var Grid = function(element, options)
this.converter = null; // The converter for the column that is marked as identifier
this.rowCount = ($.isArray(rowCount)) ? rowCount[0] : rowCount;
this.rows = [];
this.searchPhrase = "";
this.searchPhrase = this.options.initialSearchPhrase || "";
this.selectedRows = [];
this.sortDictionary = {};
this.total = 0;
Expand Down