FlexGrid Date Filtering

Object - FlexGrid

HTML

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.input.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.chart.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.filter.min.js"></script>
<div class="container">

  <h1>
    FlexGrid
  </h1>
  <p>
    The FlexGrid allows you to visualize and edit tabular data. It provides a variety of options about how to present and perform operations over the data, including selection, sorting, filtering, grouping, paging, editing, formatting, etc.
  </p>
  <p>
    Populate the FlexGrid by setting its <b>itemsSource</b> property to an array containing regular JavaScript objects. The grid will automatically generate columns to display the data items, and will allow users to select, sort, and edit the data.</p>

  <div class="input-group">
    <div class="input-group-addon"><span class="glyphicon glyphicon-search"></span></div>    
    <input id="filter" class="form-control" placeholder="Country Filter">
  </div><br />   

  <div id="flexGrid" class="custom-icons" style="font-family:Courier New"></div>
  <div>
    <span>Number of Rows:</span>
    <label id="numberOfRows" />
  </div>
</div>

CSS

.wj-flexgrid {
  max-height: 250px;
  margin-bottom: 12px;
}

.header {
  display: inline-block;
  width: 150px;
  text-align: right;
  font-weight: normal;
}

// Changes the icon for filtering the grid
.custom-icons .wj-glyph-filter {
    background-image:url('http://icons.iconseeker.com/png/fullsize/aspnet/filter-1.png');
    background-repeat: no-repeat;
    background-position: bottom right;
    margin-top: 4px;
    width: 1em; height: 1em;
    border: none;
}
.custom-icons .wj-glyph-filter:after {
    display: none;
}
/* make active filter images 25% larger */
.custom-icons .wj-filter-on .wj-glyph-filter {
    transform: scale(1.25)
}

JavaScript

onload = function() {
  // Creates a vector of strings, and a data variable to hold a list of items
  var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
    data = [],
    year = 1980;
  for (var i = 0; i < countries.length; i++) {
    // Creates attributes and assigns values to each of them for each item in the 'data' variable
    data.push({
      id: i,
      country: countries[i],
      active: i % 5 != 0,
      downloads: Math.round(Math.random() * 200000),
      sales: Math.random() * 100000,
      expenses: Math.random() * 50000,
      date: new Date(year, 0, 1),
    });
    year = year + 5;
  }
  
  var data1 = data;

  // Creates a view for a ListBox and FlexGrid to manipulate the same data
  var gridView = new wijmo.collections.CollectionView(data);
  var gridView1 = new wijmo.collections.CollectionView(data1);

  // Binds the grid to a Wijmo FlexGrid array
  var gridArray = new wijmo.grid.FlexGrid('#flexGrid', {
    // Changes the header of the binded value to what is stored in the 'header' attribute
    // You can leave columns out of the table; the 'Active' column is left out
    autoGenerateColumns: false,
    columns: [{
      header: "<input type=\"checkbox\" class=\"mycb\" onclick=\"toggleSelection(event, this, 'demo')\" />"
    }, {
      binding: "country",
      header: "COUNTRY",
      // StarWidth expands/contracts a field so that the FlexGrid isn't too wide/narrow
      width: "*"
    }, {
      binding: "downloads",
      header: "DOWNLOADS"
    }, {
      binding: "sales",
      header: "SALES"
    }, {
      binding: "expenses",
      header: "EXPENSES"
    }, {
    	binding: "date",
      header: "DATE",
      format: "MM/dd/yyyy hh:mm:ss",
    }],
    itemsSource: gridView,
    allowDragging: 2
  });
  
  document.getElementById('filter').addEventListener('input', function(e){
  	var filter = e.target.value.toLowerCase();
    gridArray.collectionView.filter = function(item){
    	return filter.length == 0 ||...