Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: Release 3.5.0
-
Fix Version/s: Release 5.4.0
-
Component/s: iOS
-
Environment:
3.5.0.GA
Description
Programmatically setting a SearchBar's value doesn't filter the ListView's rows where it is attached to, unless you focus/blur it. The value does show.
Expected behaviour
Setting the SearchBar value, either on creation or thereafter should filter the ListView (or TableView) it is attached to.
Steps to reproduce
1. Build an app with the following code
2. Confirm that both line 6 and 30 properly set the value but doesn't filter
3. Confirm that line 29 en 31 provide a workaround
Code to reproduce
var win = Ti.UI.createWindow({ |
backgroundColor: 'white' |
});
|
|
var searchView = Ti.UI.createSearchBar({ |
value: 'Row 10' |
});
|
|
var listView = Ti.UI.createListView({ |
top: 20,
|
searchView: searchView,
|
sections: [Ti.UI.createListSection({
|
items: (function() { |
var items = []; |
for (var i = 1; i < 30; i++) { |
items.push({
|
properties: {
|
title: 'Row ' + i, |
searchableText: 'Row ' + i |
}
|
});
|
}
|
return items; |
})()
|
})]
|
});
|
|
win.addEventListener('open', function() { |
// searchView.focus(); |
searchView.value = 'Row 10'; |
// searchView.blur(); |
});
|
|
win.add(listView);
|
win.open();
|