Click here to Skip to main content
15,796,456 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello guys,

I have a javascript code on my site that loads during document.ready. I want to use it to filter my datatable but it's not working. May i know if there is something wrong with this script?

<script type="text/javascript">		
		$(document).ready(function() {
			$("select#search_pad").change(function () {
			var val = $("select#search_pad option:selected").attr('value');
			var regex = (val == "" ?  "": "^"+val+"$");
			tbl_record.fnFilter (regex,1,false);

thanks in advance!

1 solution

Well, nobody will ever tell you, since nobody (except probably you) can know what's behind the tbl_record.fnFilter (regex,1,false); function call.
Just a question: if you put all this on a button click event instead of ready - is it working?
Are you sure your code is executed after the data you want to filter is actually there?
You might want to use something like this[^] to ensure that your code is run last. But be aware, that jquery api may also change, thus you might need to do a little tweaking. This[^] should also be helpful.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900