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

Search in Table but in a specific Column #30

Closed
scorpionfire opened this issue Jan 19, 2017 · 4 comments
Closed

Search in Table but in a specific Column #30

scorpionfire opened this issue Jan 19, 2017 · 4 comments

Comments

@scorpionfire
Copy link

scorpionfire commented Jan 19, 2017

Can be an idea configure Jets to search in a Table column, deciding the column in the search method.

Example

var jets = new Jets({
  searchTag: '#jetsSearch',
  contentTag: '#jetsContent',
  columns: [0,2,5]
});

jets.search("key", [0,5]);
jets.search("key", [0]);
@NeXTs
Copy link
Owner

NeXTs commented Jan 19, 2017

Can you provide an example where this feature may be usable?

@scorpionfire
Copy link
Author

Sure.
I have this table in my project (with lots more TR)

image

I add 2 textbox for search, each can be used to search in the respective column.

My idea is:

var jets = new Jets({
  contentTag: '#jetsContent',
  callSearchManually: true,
  columns: [0,4]
});

$("#txtSearch1").on("input", function(evt){
  var val=this.value;
  jets.search(val, [0]);
});
$("#txtSearch2").on("input", function(evt){
  var val=this.value;
  jets.search(val, [4]);
});

This because I don't want Jets search in all 2 column, but only in the respective column.

@NeXTs
Copy link
Owner

NeXTs commented Jan 20, 2017

Ok I see
But I'm afraid it's just not possible with current plugin's idea.
It just works in another way. Keywords are set during initialization so columns that are available for search may be set only during initialization.

@scorpionfire
Copy link
Author

scorpionfire commented Jan 20, 2017

And if during initializazion, with new param "searchInSpecificColumn: true", you add more data attribute, for example

<tr data-jets="blake norton 31" data-jets-cln0="blake norton" data-jets-cln3="31">
  <td>Blake Norton</td>
  <td></td>
  <td></td>
  <td>31</td>
</tr>

and when call new search method "jets.search(val, 0)" you generate this css

#jetsContent > :not([data-jets-cln0 *= "search_query"]){ display:none; }

@NeXTs NeXTs closed this as completed in ee01a2c Feb 11, 2017
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

2 participants