Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom attrName #18

Open
dougaraujos opened this issue May 30, 2016 · 9 comments
Open

Add custom attrName #18

dougaraujos opened this issue May 30, 2016 · 9 comments

Comments

@dougaraujos
Copy link

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.

@NeXTs
Copy link
Owner

NeXTs commented May 30, 2016

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?

@dougaraujos
Copy link
Author

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, ... });

@NeXTs
Copy link
Owner

NeXTs commented May 30, 2016

Use manualContentHandling, see in options
There are example how to handle custom attributes :)

new Jets({
  ...
  manualContentHandling: function(tag) {
    return tag.getAttribute('custom-attr-name');
  }
});

@dougaraujos
Copy link
Author

dougaraujos commented May 30, 2016

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}

@NeXTs
Copy link
Owner

NeXTs commented May 30, 2016

Ok. now I see what you want

@NeXTs
Copy link
Owner

NeXTs commented Jul 18, 2016

Let's wait for +1's to see if anyone else need this feature

@matteoannibali
Copy link

dougaraujos can I use your code? fits best for my problem

@dougaraujos
Copy link
Author

(Sorry for the delay)

Implement an example in Codepen (using Jets.js - v0.9.0 - 2016-04-26)
http://codepen.io/dougaraujos/pen/bwjoYR

@allanlaal
Copy link

I needed to sort a massive dataset on many different data attributes, so a custom attribute name is a must!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants