Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3369] Bug in tableview methods: "insertRowBefore", "insertRowAfter", "insertSectionBefore", "insertSectionAfter" - "animation" option has no effect

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-03-20T17:10:01.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy
Labelsn/a
ReporterParijat sahai
AssigneeMostafizur Rahman
Created2016-03-10T16:51:11.000+0000
Updated2016-03-20T17:10:01.000+0000

Description

There is a bug in the following tableview methods: "insertRowBefore", "insertRowAfter", "insertSectionBefore", "insertSectionAfter" where specifying the "animated" property to true has no effect and the tableview still scrolls downwards to show the newly inserted row.

Comments

  1. Sharif AbuDarda 2016-03-13

    Hello, Please provide a regeneratable sample code for each of the issue you have mentioned above. We will try it in our environment if the issue is regeneratable or not. Please use the latest SDK 5.2.0.GA for your test. Also please provide a complete list of steps to follow. Thanks.
  2. Parijat sahai 2016-03-14

    1) Create a sample app with a tableview in the main window. 2) initialize the tableview with about 20 or more rows so that they fill the entire screen when the app is launched. Also, add code during initialization to scroll the tableview to the bottommost row. 3) Add a button somewhere on the screen that when clicked inserts a new row. 4) Write "click" or "singletap" event handler for the button to execute "insertRowBefore(0,{animated:false})" 5) Run the test by launching the app and clicking the button. Notice that, despite the presence of "animated:false" parameter, clicking the button causes the tableview to scroll to display the newly inserted row.
  3. Mostafizur Rahman 2016-03-15

    Hello, Thanks for sharing with us. I have tested that issue you reported. It is not a valid issue. Setting "animated:false” is working as expected. And it doesn’t let the tabeview to animate to the newly inserted row. I have tested the below code. *Testing Environment:* *Appcelerator CLI* Installer = 4.2.3 Core Package = 5.2.0 *Operating System* Name = Mac OS X Version = 10.11.3 Architecture = 64bit # CPUs = 4 Memory = 8.0GB *Node.js* Node.js Version = 0.12.7 npm Version = 2.11.3 *Titanium CLI* CLI Version = 5.0.6 node-appc Version = 0.2.31 *Java Development Kit* Version = 1.7.0_25 *Xcode:* Version 7.1.1 *Titanium SDK:* 5.2.0.GA *Platform:* iOS *iOS Simulator:* iPhone 6/ iOS 9.1 *Test Code:*
       Ti.UI.backgroundColor = 'white';
       
       var win = Ti.UI.createWindow();
       
       
       
       var tableData = [ {title: 'Apples1'}, {title: 'Bananas2'}, {title: 'Carrots3'}, {title: 'Potatoes4'},{title: 'Apples5'}, 
       
                         {title: 'Bananas6'}, {title: 'Carrots7'}, {title: 'Potatoes8'}, {title: 'Carrots9'}, {title: 'Potatoes10'},
       
                         {title: 'Apples11'}, {title: 'Bananas12'}, {title: 'Carrots13'}, {title: 'Potatoes14'},{title: 'Apples15'}, 
       
                         {title: 'Bananas16'}, {title: 'Carrots17'}, {title: 'Potatoes18'}, {title: 'Carrots19'}, {title: 'Potatoes20'}
       
                       ];
       
       
       
       var table = Ti.UI.createTableView({
       
         data: tableData
       
       });
       
       
       
       
       
       var button = Titanium.UI.createButton({
       
       title : 'Click Me',
       
       top : 10,
       
       width : 100,
       
       height : 50,
       
       backgroundColor : 'green'
       
       });
       
       button.addEventListener('click', function(e) {
       
       var row = Ti.UI.createTableViewRow({
       
       title: "New add apple21"
       
       });
       
       table.insertRowBefore(0, row,{animated:false});
       
       //table.insertRowBefore(0, row,{animated:true});
       
       //table.insertRowAfter(1, row,{animated:false});
       
       //table.insertRowAfter(1, row,{animated:true});
       
       
       
       });
       
       
       
       table.add(button);
       
       win.add(table);
       
       win.open();
       
       
    *Test Result* It doesn’t animate when clicking the button in the tableview during display the newly inserted row. *Steps to Reproduce.* Open your Studio Create new project Copy the above code and paste it in *app.js* file Run the project Click the “*Click Me*” button to create new row.

JSON Source