【发布时间】:2022-12-21 14:15:52
【问题描述】:
这是搜索过滤器指令
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'filter'
})
export class FilterPipe implements PipeTransform {
transform(items: any[], searchText: string): any[] {
if (!items) return [];
if (!searchText) return items;
return items.filter(item => {
return Object.keys(item).some(key => {
return String(item[key]).toLowerCase().includes(searchText.toLowerCase());
});
});
}
}
下面是带有数组表的 HTML 代码
当分页搜索过滤器工作在第一页时,它工作正常。但是,当单击发送页面并搜索任何表格数据时,它不起作用并且数据表格未过滤。数据表数组显示空白。
【解决方案1】:
每次更改页面时都必须提供总项目,因此将其添加到您的代码中,它应该可以工作。
分页:{itemsPerPage:count,currentPage:p,,totalItems:userArray2.length}“
我这样解决了这个问题:D
【讨论】:
推荐
-
我们如何设置特定频道的权限(discord.py)[重复]
-
未定义变量 \'$result\'.intelephense
-
学会这10种定时任务,我有点飘了
-
由于 cli::array 关键字 Visual Studio,C++ 不能使用 std::array
-
.NET 6 - 使用 CamelCase 的 AddJsonOptions 不起作用
-
Vue js cookie 未定义
-
为什么电子无法启动?
-
EDGE 浏览器视频标签在 IOS(Vue.js 和 ASP.NET)上不起作用
-
使用 Go 将文件移动到其他驱动器
-
Elasticsearch 聚合名称长度是否有限制?
-
如何使用套接字来观看 Twilio 消息队列?
-
ErrorWhenCompilingTo Android x86_64:找不到 zlib 的头文件或库文件,这是从源代码编译 Pillow 时必需的依赖项
-
函数 findall
-
如何在 vuejs 中添加 bootstrap 5 toast 同时重定向到另一个页面(如表单提交)
-
如何在 esbuild 中使用 React Routes?
标签
-
.net-core(23)
-
numpy(22)
-
django(15)
-
javascript(791)
-
elastic-stack(22)
-
ionic-framework(25)
-
go-gorm(14)
-
kubernetes(22)
-
macos(21)
-
visual-studio(25)
-
sorting(15)
-
mysql(328)
-
elk(15)
-
python(418)
-
vite(15)
-
sass(22)
-
react-native(14)
-
go(334)
-
datetime(14)
-
vuetify.js(25)
-
tailwind-css(14)
-
date(13)
-
redis(18)
-
angular(357)
-
symfony(14)
-
arrays(65)
-
string(17)
-
electron-forge(16)
-
.net-6.0(21)
-
selenium(27)
-
rxjs(28)
-
ajax(14)
-
c#(296)
-
java(74)
-
nuxt.js(25)
-
flask(15)
-
问答(3654)
-
linux(30)
-
unity3d(25)
-
jwt(15)
-
vuejs3(50)
-
spring-data-elasticsearch(18)
-
css(94)
-
discord.js(19)
-
asp.net(37)
-
webpack(31)
-
php(359)
-
spring-boot(32)
-
laravel(99)
-
python-3.x(40)
-
axios(32)
-
electron-builder(34)
-
nest(14)
-
postgresql(34)
-
logstash(14)
-
reactjs(194)
-
windows(15)
-
express(68)
-
next.js(21)
-
c(66)
-
docker(42)
-
dataframe(21)
-
async-await(18)
-
azure(18)
-
unit-testing(30)
-
elasticsearch(294)
-
graphql(13)
-
npm(57)
-
asp.net-mvc(14)
-
wordpress(34)
-
mongoose(31)
-
electron(255)
-
firebase(21)
-
json(62)
-
c++(130)
-
asp.net-core(41)
-
node.js(526)
-
api(36)
-
jquery(35)
-
pandas(55)
-
kibana(32)
-
elasticsearch-aggregation(13)
-
spring(14)
-
vue.js(316)
-
regex(14)
-
vuejs2(32)
-
laravel-8(14)
-
database(58)
-
woocommerce(16)
-
node-modules(13)
-
visual-studio-code(39)
-
typescript(223)
-
html(183)
-
angular-material(18)
-
.net(62)
-
mongodb(55)
-
jestjs(32)
-
amazon-web-services(33)
-
nestjs(18)
-
sql(114)