Html Grid
Set the showfilterrow property of the jqxGrid.
Author: http://jqwidgets.com
HTML
<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<script src="https://jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/generatedata.js"></script>
<div id="jqxgrid"></div>
JavaScript
let $grid = $("#jqxgrid");
let data = generatedata(500);
let source = {
localdata: data,
datafields: [{
name: 'firstname',
type: 'string'
}, {
name: 'lastname',
type: 'string'
}, {
name: 'productname',
type: 'string'
}, {
name: 'date',
type: 'date'
}, {
name: 'quantity',
type: 'number'
}, {
name: 'price',
type: 'number'
}],
datatype: "array"
};
let adapter = new $.jqx.dataAdapter(source);
$grid.jqxGrid({
width: 500,
theme: 'energyblue',
showfilterrow: true,
source: adapter,
filterable: true,
sortable: true,
autoshowfiltericon: true,
columns: [{
text: 'First Name',
datafield: 'firstname',
width: 90
}, {
text: 'Last Name',
datafield: 'lastname',
width: 90
}, {
text: 'Product',
datafield: 'productname',
width: 170
}, {
text: 'Order Date',
datafield: 'date',
width: 160,
cellsformat: 'dd-MMMM-yyyy'
}, {
text: 'Quantity',
datafield: 'quantity',
width: 80,
cellsalign: 'right'
}, {
text: 'Unit Price',
datafield: 'price',
cellsalign: 'right',
cellsformat: 'c2'
}]
});
let focusFilterElement = function ($filter) {
$filter.focus();
};
let getFilterFocusedElement = function (event, callback) {
let $focusedFilter = $(document.activeElement);
if(typeof callback === 'function') callback($focusedFilter);
};
$grid.on('filter', function(event){
getFilterFocusedElement(event, function($focusedFilter){
$grid.jqxGrid('render');
focusFilterElement( $focusedFilter );// if you comment this it looses the focus.
});
});