Jets.js
Jets.js copied to clipboard
Add custom attrName
Just sharing a custom feature: I needed more searches for the same element. So I decided to add a attrName with custom name for each instance.
Hi
I am sorry but I don't get your idea. "custom name for each instance" - exactly this part isn't clear for me
Do you need to search by custom attribute?
I have three inputs. Each seeks a part of my row. But without the custom attribute, the Jets just search for 'data-jets'. So attrName added for each input.
instance = new Jets({attrName: 'data-jets-' + name, ... });
Use manualContentHandling
, see in options
There are example how to handle custom attributes :)
new Jets({
...
manualContentHandling: function(tag) {
return tag.getAttribute('custom-attr-name');
}
});
The problem is that each input search a portion of the element only. However, when instantiate three times, the CSS rule changes the display only for the data-jets
. What I needed was this:
#table-components>:not([data-jets-name*="a"]){display:none}
#table-components>:not([data-jets-price*="100"]){display:none}
#table-components>:not([data-jets-time*="3"]){display:none}
Ok. now I see what you want
Let's wait for +1's to see if anyone else need this feature
dougaraujos can I use your code? fits best for my problem
(Sorry for the delay)
Implement an example in Codepen (using Jets.js - v0.9.0 - 2016-04-26) http://codepen.io/dougaraujos/pen/bwjoYR
I needed to sort a massive dataset on many different data attributes, so a custom attribute name is a must!