jqMobi-Plugins
jqMobi-Plugins copied to clipboard
Support for Tables in filterlist
Hi there -- I made a small modification to filterlist to support tables. Before making a pull request, I wanted to see if this is outside your intended scope?
Push the change to your fork and I'll be glad to check it out.
Thanks. Done. I'm used to Subversion, so forgive me if I've messed up part of the process.
I also included code to let you specify a class to apply to the input. (I wanted to get the default styling for jq.ui -- love those rounded corners and shadows.)
Note: I changed a line in refresh() to always take the child element as the target, never the grandchild -- otherwise only the first cell of each row would be filtered. It didn't affect lists in my testing, but maybe I missed an important test case. I changed this: eachEle.target = elem.childNodes[0].tagName !== undefined ? elem.childNodes[0] : elem to this: eachEle.target = elem;
Ok - the reason I added that was for this case.
<li><a href="foo">Bar</a></li>
When searching, I want it to search the contents of the anchor tag and not the
I was thinking - if you add an option (filterChildren) that defaults to true, then it should work in both cases. You'd set it to false for tables or others.
In testing filterlist from your repository, I found that child elements actually are searched, to any depth -- is this not by design? This is the mark-up for the <li>
I used for that test case:
<li>
<div>
content nested in div
<div>two levels deep
<div>three levels deep
<div>four levels deep
<div>five levels deep</div></div></div>
</div>
</div>
</li>
I was able to search successfully for "five levels deep". I believe this is because the code looks at the innerHTML of the matched node. Perhaps we want it to go through all children of the matched nodes, compile only the values of text nodes (i.e. don't search through any HTML markup), and filter on that? We wouldn't even need a separate flag; we would hit all the text of the elements being searched.
PS -- My e-mail is [email protected] if you want to take this offline at any time, to clear up any confusion or miscommunication, and get only the resolution/official spec into the official channels.