Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Bug in inline filter builder

    SC 9.1 (online demo at http://www.smartclient.com/#filterBuilderBracketFS).
    on
    Chrome Version 35.0.1916.114 m
    Be sure your post includes:

    1) Go to http://www.smartclient.com/#filterBuilderBracketFS
    2) Paste the following code over the top of filterBuilderBracket.js

    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    isc.FilterBuilder.create({
    ID:"advancedFilter",
    dataSource:"worldDS",
    topOperatorAppearance: 'inline',
    criteria: {}
    });

    isc.ListGrid.create({
    ID: "countryList",
    width:550, height:224, alternateRecordStyles:true,
    dataSource: worldDS,
    fields:[
    {name:"countryName"},
    {name:"continent"},
    {name:"population"},
    {name:"area"},
    {name:"gdp"},
    {name:"independence"}
    ]})

    isc.IButton.create({
    ID:"filterButton",
    title:"Filter",
    click : function () {
    advancedFilter.setCriteria({"_constructor":"AdvancedCriteria","operator":"and","criteria":[
    {"fieldName":"countryCode","operator":"equals","value":"foo"},{"fieldName":"capital","operator":"equals","value":"bar"}]});
    alert(isc.JSON.encode(advancedFilter.getCriteria(), {prettyPrint:false}));
    countryList.filterData(advancedFilter.getCriteria());
    }
    })

    isc.VStack.create({
    membersMargin:10,
    members:[ advancedFilter, filterButton, countryList ]
    })

    // Perform the initial filter
    filterButton.click();
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    3) press try it button...

    Notice that the alert displays the filter criteria with not operators whereas the original one set does not have not operators.
    If the criteria is set as configuration, the correct criteria is displayed when FilterBuilder.getCriteria() is called; its only when FilterBuilder.setCriteria() is used that the criteria are negated.

    Thanks,
    Mike
Working...
X