Opened 12 years ago

Closed 12 years ago

#2918 closed defect (wontfix)

FilteringTable can not filter on hidden fields

Reported by: guest Owned by: bill
Priority: high Milestone:
Component: Widgets Version: 0.4.2
Keywords: Cc:
Blocked By: Blocking:

Description

The setFilter() method only works on visible columns, but not on additional "hidden" fields that the objects in the store have.

Attachments (1)

filter_by_row.diff (879 bytes) - added by guest 12 years ago.
Patch to make the filtering table be able to filter by full row (including hidden fields) rather than by individual columns.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 12 years ago by guest

I thought my problem here was similar:

You cannot perform "OR" based filters (ColA="mike" or ColB="true") because the callbacks only provide the current cells data.

I would like to see a rewrite along the lines of: Instead of iterating over the columns, the applyFilters function gets the data row from the data source and passes through a method set on the table (say, filterFunction).

The default filterFunction method iterates over the columns, passing each callback the cell value, to retain previous behaviour.

Users who want advanced filters can change the filterFunction method to work with the whole row, including hidden fields, rather than just the single field.

Patch coming...

comment:2 Changed 12 years ago by guest

Patch (untested): 612a613,626

filterFunction: function( data ){

summary apply column filters for(var j=0; j<this.columns.length; j++){

var value = this.store.getField(data, this.columns[j].getField()); if(this.columns[j].getType() == Date && value != null && !value.getYear){

value = new Date(value);

} if(!this.columns[j].filterFunction(value)){

return false;

}

} return true;

},

619d632 < var b=true; 621,630c634 < for(var j=0; j<this.columns.length; j++){ < var value = this.store.getField(this.getDataByRow(row), this.columns[j].getField()); < if(this.columns[j].getType() == Date && value != null && !value.getYear){ < value = new Date(value); < } < if(!this.columns[j].filterFunction(value)){ < b=false; < break; < } < } ---

var b=filterFunction( this.getDataByRow(row) );

Changed 12 years ago by guest

Attachment: filter_by_row.diff added

Patch to make the filtering table be able to filter by full row (including hidden fields) rather than by individual columns.

comment:3 Changed 12 years ago by guest

Patch didn't copy and paste well, so now attached.

comment:4 Changed 12 years ago by bill

Resolution: wontfix
Status: newclosed

FilteringTable? will be replaced by a Table widget that connects to a dojo.data source that does the filtering.

Note: See TracTickets for help on using tickets.