Announcement

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

    ListGrid: defaultFilterValue only used when autoFetchData:false

    I have a ListGrid with showFilterEditor:true and I wanted to use defaultFilterValue for one or more of the fields on the initial display of the grid. The intention being to allow the user to reduce the search criteria from a default more restrictive set. However, I've found that unless the grid has autoFetchData:false the defaultFilterValue is ignored. I'm not sure if this is intentional or a bug. It would be nice if it were a bug and it could be fixed. There isn't much documentation that I could find on defaultFilterValue, so perhaps its just the documentation that could do with a little revision?

    Here is a sample that shows the current behavior (taken from the Disable Filter example):

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:300, alternateRecordStyles:true, cellHeight: 30,
        dataSource: worldDS,
        fields:[
            {name:"countryCode", title:"Flag", width:50, type:"image", imageSize:24, imageURLPrefix:"flags/24/", imageURLSuffix:".png",
                canFilter:false
            },
            {name:"countryName", title:"Country", defaultFilterValue:'uni'},
            {name:"capital", title:"Capital",
                canFilter:false
            },
            {name:"continent", title:"Continent"}
        ],
        autoFetchData: false,
        showFilterEditor: true
    })
    If you then change the value of autoFetchData to true, the defaultFilterValue on the countryName field is not used.

    #2
    There is an subtle distinction here, which is that fetchData() is distinct from filterData(), and the filterEditor calls filterData() whereas autoFetchData:true calls fetchData(). It does seem like autoFetchData should just "do the right thing" if the filter editor is showing, since it's obvious you'll be used using filterData()..

    Comment

    Working...
    X