java - 使用分页库进行过滤/排序时如何再次显示加载程序
问题描述
enter code here
//constructor
ProductsViewModel(String seoUnique) {
// getting our data source factory
ProductsDataSourceFactory productsDataSourceFactory = new ProductsDataSourceFactory(seoUnique,
"");
// getting the live data source from data source factory
networkState = Transformations.switchMap(productsDataSourceFactory.getItemLiveDataSource(),
ProductsDataSource::getProgressLiveStatus);
// getting the total items from data source factory
total = Transformations.switchMap(productsDataSourceFactory.getItemLiveDataSource(),
ProductsDataSource::getLiveTotal);
// Getting PagedList config
PagedList.Config pagedListConfig =
(new PagedList.Config.Builder())
.setEnablePlaceholders(false)
.setPageSize(ProductsDataSource.PAGE_SIZE).build();
// Building the paged list
itemPagedList = Transformations.switchMap(filter, input -> {
if (input == null || input.isEmpty()) {
return (new LivePagedListBuilder(productsDataSourceFactory, pagedListConfig)).build();
} else {
return (new LivePagedListBuilder(new ProductsDataSourceFactory(seoUnique, input), pagedListConfig)).build();
}
});
}
加载器显示 ProductsDataSourceFactory 构造函数实例,但是当过滤器不为空时,它没有显示任何加载器,因为过滤器中我不使用 productsDataSourceFactory 构造函数实例。
请给出任何解决方案
提前致谢。
解决方案
推荐阅读
- sql-server - 如何将我计算机上的 SQL Server 数据库迁移到 AWS RDS?
- android - 如何在没有任何 clickListener 的情况下使用带有 EventBus 的导航 - android
- c++ - CPP 中的 Valgrind 和内存泄漏:“条件跳转或移动取决于未初始化的值”
- python - 如何在不导入 RAM 的情况下使用 numpy 文件?
- javascript - GeoJson 图层中的特征与 Autocad 中的角度不同
- azure - 在哪里可以找到 Azure 登录活动报告错误代码列表?
- node.js - 如何从两个表中验证登录信息
- c# - 用链接替换html正文中的标签而不匹配C#中的内联CSS
- javascript - Javascript如何获取绝对路径?
- c++ - 如何在新的派生对象中获取基础对象的数据?