Filter table rows using search box

275
February 22, 2017, at 7:09 PM

Trying to search rows based on date in a table with the following code. When I search using Leave on field related datas only should be displayed but search is not working. My code is wrong I think. Please give me some suggestions.

$(document).ready(function() {
  leaveTable()
  $(".clearSearch").click(function() {
    $('#searchLeaveReq').val("");
    $('#levListTable tr').show();
  });
  go()
});
function leaveTable() {
  for (var i = 0; i < leaveList.length; i++) {
    var tab = '<tr id="' + i + '"><td class="appliedOn">' + leaveList[i].LeaveOn +
      '</td><td class="duration">' + leaveList[i].Duration + '</td><td class="status">' + leaveList[i].Status + '</td><tr>';
    $('#levListTable').append(tab)
  }
}
function go() {
  var $records = $('#roleListTable tr');
  $('#searchLev').click(function() {
    debugger
    var val = $.trim($('#searchLeaveReq').val()).replace(/ +/g, ' ').toLowerCase();
    $records.show().filter(function() {
      var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
      return !~text.indexOf(val);
    }).hide();
  });
}

Full code:https://jsfiddle.net/66yg32y0/

Rent Charter Buses Company
READ ALSO
Animate a repeating pulse in nodes of d3.js force directed graph using properties from imported json

Animate a repeating pulse in nodes of d3.js force directed graph using properties from imported json

I'm building a force directed graph from an imported dynamic JSON, I'd like to give it a little "life" by changing position, charge, gravity and radius of the nodes based on values in the JSON fileI've found a few examples of pulsing circles but my limited...

341
OPA5: Purpose of &ldquo;and&rdquo; in promise returned from waitFor

OPA5: Purpose of “and” in promise returned from waitFor

I'm kind of new to integration testing with OPA5, so I was reading a tutorial on the dev guideThere is this and included before iTeardownMyAppFrame() in the first sample code

339
How to call function on multiple jQuery objects?

How to call function on multiple jQuery objects?

I am trying to bind a callback function an event occurring for a couple of existing jQuery objects:

376