Table data not refreshed properly after refreshBinding

When a user presses the add button, an empty row should be inserted into the DB and the row should be displayed in the first row of the table. I have it so that when the user presses the add button a stored procedure is called to make that insert, then I call a self.refreshBinding on the data property of the table. It seems to update the table as the blank name field appears, but the other fields are initialized. I also noticed that all the other values below no longer match with the name, they are either duplicated or shifted a row. When I completely refresh the page it seems to display the data how I want it. There is also this weird reaction it has when I scroll up and down in the table after pressing add the values for the empty field will clear, but the values in the rows below are still off.

Table after add:

Intended display:

The named query I used to populate the data sorted it using an ORDER BY DESC, as I wanted the latest record inserted to be displayed at the top. Ultimately, that's what was causing the table to display strangely after the refreshBinding.

Solution to fix descending sort:
Right click on the data property of the table. Find the property called 'Persistent' and make sure it is checked.
image

The value you would like to sort by must be used within the column fields. Ex, I wanted to sort by NOTIFICATION_SCHEDULE_ID, which is the field property of my last column in the table.

Under that column's properties make sure sortable is checked and set the sort property to descending.
image

Lastly, under the table's properties add the field value under the sortOrder prop.
image

2 Likes

CORRECTION: The previous solution was merely a Band-Aid to my problem. I had another functionality to edit the data within the table, which was broken when the data prop 'persistent' was turned on. The problem was not the ORDER BY DESC within the named query, but was the fact that I tried using dynamic views for the columns. As seen in my table I have 7 columns that utilize checkboxes and 2 that utilize a numeric entry field. I had one view for checkboxes and one for numeric entry fields. I utilized the parameters passed such as columnIndex within binding transformation scripts to identify what data should be displayed. I think that there was a race condition between the transformation scripts and refresh binding, causing the table to display weird after a row insert. When I made separate views for each column, I noticed that the add functionality worked as intended and displayed the data properly.