I have a YUI datatable that im live filtering from a text field. The
problem im having is when i get a lot of records, its really slow..Ive
only been using jQuery for a few months now, so im a bit of a noob.
Any help refactoring this to make it run smoother would be great.

**HTML**
  **search field
  <div class="search_member_wrap">
    <label for="dt_input">Search: </label>
    <input id="dt_input" type="text" class="member_search_input"
value="search members">
  </div>

i dont have the table HTML cause it could prove to be more confusing.
but basically im filtering by 2 different <td> values set by YUI of
Phone Number and Name.

**Script**
// This is the member data table search filter
$(document).ready(function () {
  var searchbox = $('.member_search_input');
  var member_row = $('#members_data_table_wrap table tbody tr');
  searchbox.click(function() {
    $(this).val('');
  });
   searchbox.bind('change keyup', function() {
      member_row.each(function() {
        var number = $(this).find('.yui-dt0-col-PhoneNumber div').text
();
        var name = $(this).find('.yui-dt0-col-Name div').text();
        var search_check_value = (name + number);
        var search_value = searchbox.val();
         if (search_check_value.indexOf(search_value) > -1) {
           $(this).show();
          } else {
          $(this).hide();
        }
      });
    });
});

Reply via email to