[TIMOB-23331] Windows: Implement Ti.UI.TableView filter properties
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-03-24T18:37:13.000+0000 |
| Affected Version/s | Release 5.3.0 |
| Fix Version/s | Release 6.1.0 |
| Components | Windows |
| Labels | n/a |
| Reporter | Kota Iguchi |
| Assignee | Kota Iguchi |
| Created | 2016-05-05T14:15:42.000+0000 |
| Updated | 2017-04-03T17:20:19.000+0000 |
Description
Implement
filterAttribute, filterAnchored and filterCaseInsensitive properties for Ti.UI.TableView.
var win = Ti.UI.createWindow({ backgroundColor: 'green' });
var searchBar = Ti.UI.createSearchBar();
var tableView = Ti.UI.createTableView({
search: searchBar,
data: [{ title: 'Apple', query: 'Manzana' }, { title: 'Banana', query: 'Banana' }, { title: 'Carrots', query: 'Zanahoria' }, { title: 'Potatoes', query: 'Patata' }],
filterAnchored: false,
filterCaseInsensitive: true
});
var bottomView = Ti.UI.createView({
bottom: 0, width: Ti.UI.FILL, height: '20%',
backgroundColor: 'black', layout: 'horizontal'
}),
enableAnchored = Ti.UI.createSwitch({
value: tableView.filterAnchored, titleOn: 'anchored On', titleOff: 'anchored Off'
}),
enableCaseInsensitive = Ti.UI.createSwitch({
value: tableView.filterCaseInsensitive, titleOn: 'case insensitive', titleOff: 'case sensitive'
}),
enableAttribute = Ti.UI.createSwitch({
value: false, titleOn: 'attribute On', titleOff: 'attribute Off'
});
enableAnchored.addEventListener('change', function () {
tableView.filterAnchored = enableAnchored.value;
});
enableCaseInsensitive.addEventListener('change', function () {
tableView.filterCaseInsensitive = enableCaseInsensitive.value;
});
enableAttribute.addEventListener('change', function () {
if (enableAttribute.value) {
tableView.filterAttribute = 'query';
} else {
tableView.filterAttribute = '';
}
});
bottomView.add(enableAnchored);
bottomView.add(enableCaseInsensitive);
bottomView.add(enableAttribute);
win.add(tableView);
win.add(bottomView);
win.open();
*Expected:*
* Typing A with filterCaseInsensitive: true & filterAnchored:false should list all items
* Typing A with filterCaseInsensitive: false & filterAnchored:false should show only Apple
* Typing A with filterAnchored:true should show only Apple
* Typing Za with filterAttribute, filterCaseInsensitive: true & filterAnchored:false should show Apple and Carrots
* Typing Za with filterAttribute, filterCaseInsensitive: true & filterAnchored:true should show only Carrots
https://github.com/appcelerator/titanium_mobile_windows/pull/953
Verified in 6.1.0.v20170401095755. Test and other information can be found at https://github.com/appcelerator/titanium_mobile_windows/pull/953