Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5289] iOS: TableView searchHidden property is ignored

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2014-03-11T17:27:25.000+0000
Affected Version/sRelease 1.7.2, Release 1.8.0.1, Release 3.2.3
Fix Version/sSprint 2012-02, Release 2.0.0, Release 1.8.1, Release 3.2.0
ComponentsiOS
Labelsmodule_tableview, parity, qe-testadded, supportTeam
ReporterKarol Pomaski
AssigneeVishal Duggal
Created2011-09-15T08:50:15.000+0000
Updated2014-03-12T09:18:08.000+0000

Description

Problem

Setting the data dynamically to the TableView makes it ignore the searchHidden property.

Reproducible Steps

1. Run the code 2. Press "press" button

Expected behavior

After using the setData() method within the tableView it should respect the previous searchHidden property set.

Remarks

The TableView instance was created with the property "searchHidden: true". It works correctly for the first time (the searchBar is hidden). After setting the new data into the tableView using setData() method looks like it overrides the searchHidden property and sets it to FALSE. The searchBar is not anymore hidden.

Code

var win = Titanium.UI.createWindow({ backgroundColor:'#fff' });
var search = Titanium.UI.createSearchBar({
    barColor:'#000', 
    showCancel:true,
    height:43,
    top:0,
});
var table = Titanium.UI.createTableView({
	search:search,
    searchHidden:true,
    scrollable: true
    });
    
var bt1 = Ti.UI.createButton({
	title: "press",
	width: 100,
	height: 25,
	bottom: 10,
	left: 0
});
bt1.addEventListener("click",function(e){
	var arr = [];
	arr = [{title:"Row5"},{title:"Row 6"}];
	table.setData(arr);
});
win.add(table);
win.add(bt1);
win.open();

Associated HelpDesk Ticket

http://appc.me/a/APP-912357

Attachments

FileDateSize
ti1.png2011-09-15T10:17:42.000+0000118954
ti2.png2011-09-15T10:17:42.000+0000126059

Comments

  1. Pedro Enrique 2011-09-15

    The tableView needs to set the searchHidden to true when the data is reloaded.
       bt1.addEventListener("click",function(e){
       	var arr = [];
       	arr = [{title:"Row5"},{title:"Row 6"}];
       	table.setData(arr);
       	table.searchHidden=true
       });
       
  2. Karol Pomaski 2011-09-15

    Setting the searchHidden property after the setData() method makes the searchBar to appear for a while. The point is to fix the TableView so that it would respect the searchHidden property that was set before. The searchBar should be hidden.
  3. Natalie Huynh 2012-01-12

    Tested with 1.9.0.v20120112104633 with iPod 4.3.3
  4. Stephen Tramer 2012-01-16

    Reopening for manual merge to 1.8.1.
  5. Eric Merriman 2012-01-18

    Reopening for confirmation that the behavior we are seeing is expected. After clicking the button on the test app, the search bar is displayed then gets hidden. Is this the desired effect?
  6. Stephen Tramer 2012-01-18

    Kind of. We automatically display the search bar if it exists, then animate it out if it's supposed to be hidden. That's a separate bug but I can't remember the number for it offhand.
  7. Vishal Duggal 2012-01-19

    Have a pull request up for TIMOB-7273 that also fixes this issue. The search bar is now hidden without animation. https://github.com/appcelerator/titanium_mobile/pull/1211
  8. Sabil Rahim 2012-01-19

    for 1_8_X branch PR https://github.com/appcelerator/titanium_mobile/pull/1214
  9. Natalie Huynh 2012-01-19

    Fail - Tested with 1.9.0.v20120119134634 with iphone 4s (5.0.1), the table view now does not animate on update, but animates on launch.
  10. Natalie Huynh 2012-01-23

    Confirmed that the animation on launch is expected and been there since 1.7.5 and 1.8.0.1
  11. Priya Agarwal 2013-11-22

    Reopening since searchbar is visible when app launches also. After clicking press button also the searchbar is still visible.
        var win = Titanium.UI.createWindow({ backgroundColor:'#fff' });
        var search = Titanium.UI.createSearchBar({
            barColor:'#000', 
            showCancel:true,
            height:43,
            top:0,
        });
        var table = Titanium.UI.createTableView({
        	search:search,
            searchHidden:true,
            scrollable: true
            });
            
        var bt1 = Ti.UI.createButton({
        	title: "press",
        	width: 100,
        	height: 25,
        	bottom: 10,
        	left: 0
        });
        bt1.addEventListener("click",function(e){
        	var arr = [];
        	arr = [{title:"Row5"},{title:"Row 6"}];
        	table.setData(arr);
        	table.searchHidden=true;
        });
        win.add(table);
        win.add(bt1);
        win.open();
        
    TestEnvironment: Appcelerator Studio: 3.2.0.201311200357 SDK:3.2.0.v20131121163252 alloy: 1.3.0 acs: 1.0.7 npm: 1.3.2 titanium: 3.2.0-alpha titanium-code-processor: 1.1.0-alpha Xcode:5.0.2 OS: Mac OSX 10.9 Device: iphone5S(V7.0.2)
  12. Shak Hossain 2014-02-11

    This issue can't be reproduced with TISDK 3.2 or higher. Therefore, marking it as resolved.
  13. Paras Mishra 2014-03-11

    Reopening the issue as when pulling the tableview, searchbar is shown evenif the searchHidden property is set to true. Environment used: Device : iPod touch 2 , iOS version: 7.1 SDK: 3.2.3.v20140310185916 CLI version : 3.2.1 OS : MAC OSX 10.9 Alloy: 1.3.1 ACS: 1.0.14 npm:1.3.2 Appcelerator Studio, build: 3.2.2.201403061827 titanium-code-processor: 1.1.0 XCode : 5.1 Beta 5
  14. Vishal Duggal 2014-03-11

    That is expected behavior. searchHidden only controls if the searchBar is initially hidden from the user. The user can always pull down the tableView to see it and enter data.
  15. Paras Mishra 2014-03-12

    Verified the fix, closing the issue as per the Vishal comment Environment used: Device : iPhone 5s , iOS version : 7.1 SDK: 3.2.3.v20140311115447 CLI version : 3.2.1 OS : MAC OSX 10.9 Alloy: 1.3.1 ACS: 1.0.14 npm:1.3.2 Appcelerator Studio, build: 3.2.2.201403061827 titanium-code-processor: 1.1.0 XCode : 5.1

JSON Source