question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Table (view) is not update when the rows are updated

See original GitHub issue

I’m submitting a … (check one with “x”)

[ X] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior

I’ve a table which I update using a method like newRow

newRow(){
  this.rows.unshift({
      price: 100,
      duration: 60,
      state: 1,
     });
}

where

<datatable #datatableTeaching class="material" 
            [rows]="rows" 
            [columnMode]="'force'"
            [headerHeight]="auto"
            [rowHeight]="'auto'"
            [footerHeight]="'auto'"
            >
....

But the view (table) is not update since that I resize the window. Although the element is pushing in the array.

The problem is the same when I remove the element from the row.

Expected behavior

The view (table) and the array is updated with a new element.

Reproduction of the problem

What is the motivation / use case for changing the behavior?

I need update a table in real time for user interaction, which works in the old version 0.6.1.

  • Table version: 1.2
  • Angular version: 2.0.1
  • Browser: [all ]
  • Language: [all]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:67 (42 by maintainers)

github_iconTop GitHub Comments

13reactions
elvisbegoviccommented, Nov 9, 2016

@amcdnl from my class I use @ViewChild('datatable') datatable; then I refresh using this.datatable.refresh() after delete row but … nothing’s happend … it doesn’t refresh, why ?

PS: in fact when I delete or edit and after that if I resize window or scroll inside datatable a litle bit …my data are updated !! why this behavior , here’s my gif

refresh data

5reactions
shattarcommented, Nov 7, 2016

This is definitely the way ng2 is intended to work, however, it feels a bit awkward for this particular component… seeing as how the main function is to render an array to the screen.

See the comments on issue #32. The filter demo method has some other undesirable side effects, I mean… it filters properly, but… sort the list, then type in a filter, sorting breaks.

Kind of caught between a rock and a hard place. We want OnPush for efficient change detection, but that will cause us to create copies of the row data on every update, which is not efficient, and currently doesn’t function really well anyway. It would be nice if there were a cheaper way to tell the component to check for change. It would also be nice if this components state information were not stored in the applications input rows, so that when a new array is given, the state information is not lost.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ios - tableview does not update
You have to call reloadData() when you want to update the tableView content (when your DataService.instance value is updated).
Read more >
UITableView sometimes not updating
Hey everybody,. first of all, I'm new in Swift (but not new in software development). I'm currently trying to create a private app...
Read more >
TableView does not update according to search terms – Swift
I'm unable to have the tableView reflect the search terms accordingly. ... Filter does not update properly i.e. data that is filtered is...
Read more >
Thread: Table View not Updating after adding a new Row
The view should update automatically if the model changes. Maybe check if you are updating a different model than the one you are...
Read more >
QTableView Not Updating After Adding a New Row
The issue I am getting is that my Table View isn't updating automatically after adding or inserting the new data. But if I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found