[TIMOB-27303] Windows: Issue with TableView scrollend event (Windows 10 uwp apps)
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Won't Do |
| Resolution Date | 2020-05-15T18:25:20.000+0000 |
| Affected Version/s | Release 7.0.2, Release 8.0.2 |
| Fix Version/s | n/a |
| Components | Windows |
| Labels | n/a |
| Reporter | Aminul Islam |
| Assignee | Unknown |
| Created | 2019-08-02T13:48:28.000+0000 |
| Updated | 2020-05-15T18:25:26.000+0000 |
Description
Hello!
Scroll event attached in Ti.UI.createTableView. After scroll event-triggered then the user wants to refresh table view. While scrolling, the table view shows blank.
This is happening in Windows 10 app (UWP) but working fine in android/iOS
Teste project: TestUWP.zip
*Steps to reproduce:*
1. Import attached project.
2. Build with sdk 8.0.2.GA or 7.0.2.GA on Windows 10 uwp apps on Windows Desktop
3. Scroll the table view
4. It showing blank
Operating System
Name = Microsoft Windows 10 Pro
Version = 10.0.17134
Architecture = 32bit
# CPUs = 4
Memory = 17091956736
Node.js
Node.js Version = 8.9.1
npm Version = 5.5.1
Titanium CLI
CLI Version = 5.1.1
Titanium SDK
SDK Version = 8.0.2.GA
SDK Path = C:\ProgramData\Titanium\mobilesdk\win32\8.0.2.GA
Target Platform = windows
Thanks
Attachments
| File | Date | Size |
|---|---|---|
| TestUWP.zip | 2019-08-02T13:44:17.000+0000 | 101637 |
So it turns out the reason why table view shows blank is because UI is too busy rendering the table view. We see there are multiple reasons there;
Updating
In theTableView.datacauses re-creating of _entire_ table view rowscrollendevent in [^TestUWP.zip] shows that you updateTableView.dataproperty with empty array, and the update with concatenated array like below:However, this cause _re-creation of entire table view row_ despite you only want to append new rows. Instead of doing this, following code would be much better because this does not re-create entire table view rows.tblPartsList.addEventListener('scrollend', function(e){ var cData = generateRamdomArray(); searchedResult = searchedResult.concat(cData); tblPartsList.data = []; tblPartsList.data = searchedResult; });tblPartsList.addEventListener('scrollend', function(e){ var cData = generateRamdomArray(); tblPartsList.appendRow(cData); });
We see that Windows desktop TableView firesscrollendis fired too often when you drag scroll bar on Windows desktopscrollendtoo often when you drag scroll bar. This is because Windows UWP component actually fires the event too often and Titanium is only forwarding the event acoordingly:( FYI this does not happen when you click (not drag) scroll bar arrow button so I would think this is platform component behavior bug but TIMOB-27335 will be taking care of this to try to suppress this.Windows TableView is basically heavy weight UI component
WindowsTableViewandListViewis relatively heavy weight UI component. You might want to check out the https://github.com/appcelerator-modules/ti.xaml.listview - we have much more lightweight module to represent tables - in case you want to push lot more rows to the table.https://github.com/appcelerator/titanium_mobile_windows/pull/1422