Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-769] searchBar issues

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:11.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.3.0
ComponentsiOS
Labelsapidoc, documentation
ReporterNolan Wright
AssigneeBlain Hamon
Created2011-04-15T02:36:00.000+0000
Updated2011-04-17T01:54:11.000+0000

Description

showCancel is being ignored - the cancel button is shown on focus of the search bar

search bar also hides after row selection even when searchHidden is false. if searchHidden is false, the search bar should be always visible.

Comments

  1. Stephen Tramer 2011-04-15

    Part (2) seems to be false (a 'works for me'). Part (1) might be illegal; the 'cancel' button stops the search and unloads the table view. Even if showsCancel is set to 0 on the search bar, the table seems to want to display it anyway. Would have to look more into it.

  2. Stephen Tramer 2011-04-15

    First part of the bug is, in fact, illegal. UISearchDisplayController autosets the showsCancelButton to YES, and although we can cache the original value, set it, and redisplay, the 'cancel' button still shows up for a second, creating an inconsistent (and ugly) UI. We'll just have to say that this is a misfeature.

    Second part is still a 'works for me.'

    Marking as invalid. Please inform me if there are additional problems.

  3. Nolan Wright 2011-04-15

    run this example:

    it does look like the hide went away. but the showCancel:false is not working and now search does not seem to work - i.e., the results are not limited by matching rows

    var win = Titanium.UI.createWindow();

    // create table view data object var data = [];

    data[0] = Ti.UI.createTableViewRow({hasChild:true,title:'Row 1'});
    data[1] = Ti.UI.createTableViewRow({hasDetail:true,title:'Row 2'});
    data[2] = Ti.UI.createTableViewRow({hasCheck:true,title:'Row 3'});
    data[3] = Ti.UI.createTableViewRow({title:'Row 4'});

    var search = Titanium.UI.createSearchBar({

       barColor:'#385292',
       showCancel:false
       

    }); search.addEventListener('change', function(e)
    { e.value // search string as user types }); search.addEventListener('return', function(e)
    { search.blur(); }); search.addEventListener('cancel', function(e)
    { search.blur(); });

    // create table view var tableview = Titanium.UI.createTableView({

       data:data,
       search:search,
       

    });

    // create table view event listener tableview.addEventListener('click', function(e)
    {

       // event data
       var index = e.index;
       var section = e.section;
       var row = e.row;
       var rowdata = e.rowData;
       Titanium.UI.createAlertDialog({title:'Table View',message:'row ' + row + ' index ' + index + ' section ' + section  + ' row data ' + rowdata}).show();
       

    });

    win.add(tableview);
    win.open();

  4. Stephen Tramer 2011-04-15

    You're right, search doesn't appear to work - but this might be a more general issue where search just doesn't work (meaning it could have difficulty pulling certain information out of a tableview; I'd have to look into it). Feel free to create a bug for this and I'll look into it.

    As mentioned above, setting showCancel:false is overridden by the UISearchDisplayControl for (probably bad) reasons, but it's set at a point before we can interact with the search bar and clear the 'cancel' button out - and the button is already displayed at this point. This creates an ugly UI inconsistency where the search bar appears to have a 'cancel' option, but then suddenly doesn't. I can change this if you'd like.

    There might be an undocumented API for this but undocumented APIs are bad juju. Keeping the bug 'invalid' until we've got an answer.

  5. Nolan Wright 2011-04-15

    the search within the table view has always worked - so something has changed recently (since 1.2.0) to break it.

    the showCancel problem is also a new problem (since 1.2.0).

    both need to be addressed

  6. Stephen Tramer 2011-04-15

    Reopening. Didn't see Nolan's comment earlier in the month.

  7. Stephen Tramer 2011-04-15

    Okay, this really does appear to have been fixed now. I tested Nolan's JS and it worked.

  8. Ygor Lemos 2011-04-15

    searchHidden parameter work but it is still not documented on official API !

    Check: http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.SearchBar-object"> http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI....

JSON Source