-
Notifications
You must be signed in to change notification settings - Fork 753
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
filter row with input value #502
Comments
Hi @johannsan! It is already possible. Please check out the grouping widget demo and change any of the text in the "inputs" column. |
In this demo, you don't use the filter option but the sorting option. <script type="text/javascript" src="jquery.tablesorter/jquery.tablesorter.js"></script>
<script type="text/javascript" src="jquery.tablesorter/jquery.tablesorter.widgets.js"></script>
<script type="text/javascript" src="jquery.tablesorter/parser/parser-input-select.js"></script>
<script type="text/javascript" src="jquery.tablesorter/parser/widget-grouping.js"></script>
...
<td><input type="text" readonly="true" name="tarif.listeValeurs[0].id" value="1" id="Tarif-TarifModifierValider_tarif_listeValeurs_0__id"/></td>
</tr><tr>
<td><input type="text" readonly="true" name="tarif.listeValeurs[1].id" value="2" id="Tarif-TarifModifierValider_tarif_listeValeurs_1__id" /></td>
... $('#TarifValeura').tablesorter(
{
theme:'blue',
headers: {
0: { sorter: "inputs" },
2: { sorter: "inputs" },
3: { sorter: "inputs" }
},
widgets: ['zebra','filter','group']
}); |
Oh I see... the problem is that the filter isn't using the parsed data. Either add a <th class="filter-parsed">Inputs</th> Or add $('#TarifValeura').tablesorter({
theme:'blue',
headers: {
0: { sorter: "inputs", filter: "parsed" },
2: { sorter: "inputs", filter: "parsed" },
3: { sorter: "inputs", filter: "parsed" }
},
widgets: ['zebra','filter','group']
}); In the next update, I'll make the parser automatically add that parsed flag. |
It's ok, It's work with parser-input-select.js a when I only add sorter: "inputs", filter: "parsed". There is no link with without widget-grouping.js Thanks |
The {...,filter: "parsed"} does not seem to work for me. The sorting works fine for all columns. But I can not get the filter work for columns 3 and 6. I do not need the group feature, so I removed it from your example. Parsing defined in headers:{}: http://jsfiddle.net/phcjb314/ Thank you |
Hi @I3igI3uilder! Thanks for reporting this problem! I'll have it fixed in the master branch shortly. I plan to release a new version by this weekend. |
Hey Mottie Thank you for your dedication. |
@Mottie i cant get the filter columns for inputs to work at all. looking at @I3igI3uilder jsfiddle examples i am doing exactly the same, when ever i type in the filter it hides all rows in my table.
As the user is building the table manually i add the extractor, sort and filter to the header in jquery. |
@Mottie the select filter sort of works, for example the select will have options such as "a,b,c,d". However when the filter select is loaded the first option is blank and then the second value is just "a". if i select "a" it filters correctly. when i debug i notice that this line |
@Mottie finding more as i go along, sorry to be a pain! :) if i add both |
Hi @bish25! Would you please share a demo of the problem? I'm not understanding a few things in the comments provided:
That sounds like you shouldn't be setting a parser for that column. The parser setting only be active if you want the user input to be compared with the parsed content. For example comparing the user input with a selected option. You must not need to set both the extractor and parser to the same function... e.g.
I have no idea what this means. The description of these variables doesn't sound like valid javascript to me... how is
I don't think this will do anything, unless you have a custom widget named "sort"
This sounds like a parser isn't being set for that column. The filter is grabbing the |
Hi @Mottie, sorry this section |
@Mottie Sorry i cant get the soultion working in fiddle js, it might be pointless but read the comments https://jsfiddle.net/rkcz4tgt/8/ |
@Mottie http://jsfiddle.net/yvkj5hcg/ as you can see the filter doesn't work in the vehicle section, is there a way to add this to the class just like sort? as my table is generated in javascript |
@Mottie Apologies for the spam but i have got everything working now, just one last question 😆 there seems to be a little bug, if i type in the input field and then quickly sort the column the selects in another row revert back to default state, however if i type in the input field then wait about 5 seconds then it works fine and keeps my selected data. |
Is the table being dynamically updated? I mean can the user add and remove rows at any time?
Hmm, I searched the entire repo and that code does not exist.
That's fine, have the code to see helps alot... as I said, you can't add the same extractor and parser to a column. Change this line to only use the parser: if (sort) {
header.addClass("sorter-inputs");
}
It's not working in that demo because the column doesn't have "sorter-inputs" set on it. So the filter is only seeing empty cells.
I wonder if the table isn't properly being updated when an input/select has changed... the select column should have a "sorter-select" class name added to use the specific select parser. Also, set the |
With the input-parser, it's possible to sort a column with an input value.
But it's not possible to use the "filter widget" with input value in the cells.
Is it a future option?
Thanks.
The text was updated successfully, but these errors were encountered: