Click here to Skip to main content
15,443,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

http://net.tutsplus.com/tutorials/javascript-ajax/using-jquery-to-manipulate-and-filter-data/[^]

In this page a very useful code for Data filtering is Given. and it Helps me a lot. but Now what I am trying to do is using this code I have to Filter data for each and every column not for the whole Table using a Dropdownlist. and I am facing difficulty here

Can anybody help me to do this?
Need some guide or sample
Posted
Updated 9-Feb-12 20:03pm
v2
Comments
Orcun Iyigun 10-Feb-12 2:03am    
Edited the link.

1 solution

C#
function Fliter (Obj) {
    var grid=document.getElementById('gridID');
        var terms = Obj.value;
        var cellNr = this.filterCellIndex;//your  grid cellindex
        var ele;
        for (var r = 1; r < grid.rows.length; r++) {
            ele = grid.rows[r].cells[cellNr].innerHTML.replace(/<[^>]+>/g, "");
            if (ele.toLowerCase().indexOf(terms) >= 0)
                grid.rows[r].style.display = '';
            else grid.rows[r].style.display = 'none';
        }
    };
 
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