[TIMOB-769] searchBar issues
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:54:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.3.0 |
Components | iOS |
Labels | apidoc, documentation |
Reporter | Nolan Wright |
Assignee | Blain Hamon |
Created | 2011-04-15T02:36:00.000+0000 |
Updated | 2011-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.
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.
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.
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({
}); 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({
});
// create table view event listener tableview.addEventListener('click', function(e)
{
});
win.add(tableview);
win.open();
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.
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
Reopening. Didn't see Nolan's comment earlier in the month.
Okay, this really does appear to have been fixed now. I tested Nolan's JS and it worked.
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....