JavaFX TableView中的快速过滤 [英] Fast filtering in javafx tableview
问题描述
我需要在Javafx tableview中实现具有大数据(大约100,000个)的过滤器,
I need to implement a filter in javafx tableview with huge data (around 100,000 ),
我已经尝试过本教程.它可以工作,但与swing 排序和过滤,
I have tried this tutorial. It works but filtering is really slow as compared to swing sorting and filtering, code.
任何人都可以帮助我提高速度.
Can anyone help me to increase speed.
现在发生的事情是,当我键入textproperty change并启动了filterdata,但是速度很慢时,我需要一些可以快速显示输入结果的过滤器结果.
What is happening right now is as I type textproperty change fire up and filterdata but it is slow, I need something which shows filter result with typing quickly as happening in swing.
提前谢谢.
p.s我也看过此.
推荐答案
您可以使用FilteredList
You may use FilteredList
ObservableList<YourObjectClass> actualList = ...;
FilteredList<YourObjectClass> filteredList = new FilteredList<>(actualList);
TableView table = ...;
table.setItems(filteredList);
// to filter
filteredList.setPredicate(
new Predicate<YourObjectClass>(){
public boolean test(YourObjectClass t){
return false; // or true
}
}
);
与挥杆一样快((可能快于挥杆...). (我测试了100000行)
as fast as swing, (maybe faster then swing... ). (I tested with 100000 rows)
这篇关于JavaFX TableView中的快速过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!