简体   繁体   English

PrimeNG - 表/树表订阅更改

[英]PrimeNG - Table / Treetable subscribe to changes

I am using a primeng table with a rather large dataset.我正在使用带有相当大数据集的primeng 表。 I am not using lazy loading - there is one large get at the start which returns hundreds of rows.我没有使用延迟加载 - 开始时有一个大的 get 返回数百行。 The requirement is to have all the rows up-front on page load.要求是在页面加载时将所有行放在前面。

I have implemented a series of manual filters to manipulate that dataset.我已经实现了一系列手动过滤器来操作该数据集。 These filters read from and manipulate a list of rows which were first populated on page load.这些过滤器读取并操作在页面加载时首先填充的行列表。 At no point do these filters read from the server again.这些过滤器决不会再次从服务器读取。 When I click on a filter, there is a delay of a second or two where the underlying rows for the datatable are updated and the UI is updated.当我单击过滤器时,会出现一两秒的延迟,其中数据表的基础行会更新,并且 UI 会更新。 It appears that when this happens, it's not asynchronous - I say this because nothing else can be clicked when this occurs.似乎发生这种情况时,它不是异步的 - 我这样说是因为发生这种情况时无法单击任何其他内容。 The application effectively hangs during this period which isn't a great user experience.应用程序在此期间有效挂起,这不是很好的用户体验。

I think a way to work around this would be to somehow subscribe to the event and show a loader while this is happening.我认为解决此问题的一种方法是以某种方式订阅事件并在发生这种情况时显示加载程序。 There are outputs on the datatable which fire events when certain actions occur (onSort, onNodeExpand and so on) but these run as soon as the action occurs and don't provide an observable.数据表上的输出会在发生某些操作(onSort、onNodeExpand 等)时触发事件,但这些输出会在操作发生时立即运行并且不提供可观察的。 I have seen docs related to changeDetectorRef which may be what I'm after but I don't completely understand it.我看过与 changeDetectorRef 相关的文档,这可能是我所追求的,但我并不完全理解它。

Does anyone know if I can get the event while it is loading?有谁知道我是否可以在加载时获取事件?

Thanks very much非常感谢

I couldn't see a way around this.我看不出有什么办法解决这个问题。 The table / component was loading too big of an object which meant any in-memory browser filtering made the application hang.表/组件加载的对象太大,这意味着任何内存浏览器过滤都会使应用程序挂起。 I moved all of my filtering to the server.我将所有过滤都移到了服务器上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM