diff --git a/dist/jquery.bootgrid.css b/dist/jquery.bootgrid.css index 1803491..18111da 100644 --- a/dist/jquery.bootgrid.css +++ b/dist/jquery.bootgrid.css @@ -18,12 +18,14 @@ vertical-align: middle; width: 180px; } -.bootgrid-header .search .glyphicon, -.bootgrid-footer .search .glyphicon { +.bootgrid-header .search .fa-solid, +.bootgrid-footer .search .fa-solid { top: 0; } .bootgrid-header .search .fa, -.bootgrid-footer .search .fa { +.bootgrid-header .search .fa-solid, +.bootgrid-footer .search .fa, +.bootgrid-footer .search .fa-solid { display: table-cell; } .bootgrid-header .search.search-field::-ms-clear, diff --git a/dist/jquery.bootgrid.js b/dist/jquery.bootgrid.js index d8b6e72..5b3769d 100644 --- a/dist/jquery.bootgrid.js +++ b/dist/jquery.bootgrid.js @@ -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(); @@ -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; @@ -1239,6 +1242,9 @@ Grid.defaults = { return value ? moment(parseInt(value)*1000) : ""; }, to: function (value) { + if (!moment.isMoment(value)) { + value = moment(parseInt(value)*1000); + } return value ? value.format("lll") : ""; } }, diff --git a/src/internal.js b/src/internal.js index 0cebaf7..98a648e 100644 --- a/src/internal.js +++ b/src/internal.js @@ -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(); diff --git a/src/public.js b/src/public.js index b5b3e88..62bd50a 100644 --- a/src/public.js +++ b/src/public.js @@ -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; @@ -264,6 +264,9 @@ Grid.defaults = { return value ? moment(parseInt(value)*1000) : ""; }, to: function (value) { + if (!moment.isMoment(value)) { + value = moment(parseInt(value)*1000); + } return value ? value.format("lll") : ""; } }, @@ -324,12 +327,12 @@ Grid.defaults = { dropDownMenuText: "dropdown-text", // must be a unique class name or constellation of class names within the actionDropDown footer: "bootgrid-footer container-fluid", header: "bootgrid-header container-fluid", - icon: "icon glyphicon", - iconColumns: "glyphicon-th-list", - iconDown: "glyphicon-chevron-down", - iconRefresh: "glyphicon-refresh", - iconSearch: "glyphicon-search", - iconUp: "glyphicon-chevron-up", + icon: "icon fa-solid", + iconColumns: "fa-list", + iconDown: "fa-chevron-down", + iconRefresh: "fa-arrows-rotate", + iconSearch: "fa-magnifying-glass", + iconUp: "fa-chevron-up", infos: "infos", // must be a unique class name or constellation of class names within the header and footer, left: "text-left", pagination: "pagination", // must be a unique class name or constellation of class names within the header and footer