immutable property problems in update version, p-growl and p-dataTable

UI Components for Angular
Post Reply
Chiro
Posts: 5
Joined: 15 Nov 2016, 00:16

17 Sep 2017, 21:35

Hello,

I have an application with the 2.0.0 primeng version, I'm update this to ^4.0.0, and I have a lot problem with the immutable property, I need add this in all p-dataTable and p-growl, I need set in all code this property to false, because if true in the p-growl case the element don't remove after life time, and in p-dataTable case if i use myArray.push() function, my datatable does not update records, my question is, this is the correct work or something is wrong in my update?

Thanks!

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

22 Sep 2017, 14:18

Please, can you check your code with documentation in PrimeNG( https://www.primefaces.org/primeng/#/growl or https://www.primefaces.org/primeng/#/datatable )
Change Detection
DataTable either uses setter based checking or ngDoCheck to realize if the underlying data has changed to update the UI. This is configured using the immutable property, when enabled (default) setter based detection is utilized so your data changes such as adding or removing a record should always create a new array reference instead of manipulating an existing array as Angular does not trigger setters if the reference does not change. For example, use slice instead of splice when removing an item or use spread operator instead of push method when adding an item. On the other hand, setting immutable property to false removes this restriction by using ngDoCheck with IterableDiffers to listen changes without the need to create a new reference of data. Setter based method is faster however both methods can be used depending on your preference. Note that immutable property also defines how DataTable treats the data, for example when immutable is enabled sorting does not mutate the original data but creates a new array of sorted data.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests