Forum Stats

  • 3,770,464 Users
  • 2,253,118 Discussions
  • 7,875,466 Comments

Discussions

Issue with ojTable Refresh

Ravi Peddi-Oracle
Ravi Peddi-Oracle Member Posts: 1 Employee
edited Dec 7, 2015 11:13AM in Oracle JET

viewModel code - [JavaScript] ojTable Refresh Issue - Pastebin.com

I'm trying to refresh table after button click function (KO bound with GetEnv). With every click, I'm removing all previous data in deptObservableArray, refreshing table, collecting data from AJAX and pushing it into deptObservableArray. After pushing, deptObservableArray only has one element (8280) in it but the UI component table shows 2 more rows of 7309, they weren't removed and refreshed from the previous data before button click. During debugging, I found after table refresh it only removes first rows but following rows aren't removed, there were 3 rows of 7309 but only 1 is removed after remove all and refresh. Please help me with this. Thanks.

Screenshot 2015-12-07 18.30.10.png

Answers

  • John 'JB' Brock-Oracle
    John 'JB' Brock-Oracle Posts: 2,700 Employee
    edited Dec 7, 2015 11:13AM

    There isn't any need to remove all of the data from the observableArray before repopulating. Nor is there a requirement to call "refresh" on the ojTable component.  This is the benefit of an observableArray.  Just change the content of the observable and the ojTable component will auto-update with the new data.

    Please try doing the update of the observable only and see what that does for you.