Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Striped alternate lines not working after filtering.

Status
Not open for further replies.

miikel

ISP
Jul 28, 2004
21
GB
Hello there Tek-Tips experts.

im using ajax/jquery to apply stripes to alternative lines on a table of products, as below:

<script>
$(function () {
$('#target2').bind('keyup', function () {
$('#form').delay(700).submit();
});
$("#form").submit(function (event) {
event.preventDefault();
$.ajax
({
url: "Sops/SearchResults",
datatype: "html",
type: "post",
data: $("#form").serialize(),
success: function (stockData) {
$("#myProds").html(stockData.viewModel).hide().fadeIn();
}
});
return false;

});
$("#myProds tr:even").css("background-color", "silver");
$("#myProds a").live("click", function () {
$.get($(this).attr("href"), function (response) {
$("#myProds").replaceWith($("#myProds", response));
$("#myProds tr:even").css("background-color", "silver");
});
return false;
});
});
</script>

the first part filters as the user types into a search box, the second reapplies the stripes and does some async updates on page changes.

all this works except that when i filter on the products, i lose the stripes.

is there a way to format this so that the stripes get reapplied after the filtering has taken place?

apologies if there is not enough information or if i have missed something crucial. please let me know what you need to further troubleshoot this.

by the way, im using MVC C#, in case it is relevent.

Thanks for reading.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top