Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23331] Windows: Implement Ti.UI.TableView filter properties

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-03-24T18:37:13.000+0000
Affected Version/sRelease 5.3.0
Fix Version/sRelease 6.1.0
ComponentsWindows
Labelsn/a
ReporterKota Iguchi
AssigneeKota Iguchi
Created2016-05-05T14:15:42.000+0000
Updated2017-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

Comments

  1. Kota Iguchi 2017-02-16

    https://github.com/appcelerator/titanium_mobile_windows/pull/953
  2. Samir Mohammed 2017-04-03

    Verified in 6.1.0.v20170401095755. Test and other information can be found at https://github.com/appcelerator/titanium_mobile_windows/pull/953

JSON Source