@@ -27,7 +27,7 @@ module.exports = React.createClass({
2727 csvTemplateFormat : false ,
2828 defaultStyles : true ,
2929 nPaginateRows : 25 ,
30- solo : null ,
30+ solo : { } ,
3131 hiddenColumns : [ ] ,
3232 sortBy : null ,
3333 sortDir : 'asc' ,
@@ -113,6 +113,8 @@ module.exports = React.createClass({
113113 } ,
114114
115115 render : function ( ) {
116+ var self = this
117+
116118 var html = (
117119 < div className = 'reactPivot' >
118120
@@ -133,14 +135,23 @@ module.exports = React.createClass({
133135 </ button >
134136 </ div >
135137
136- { ! this . state . solo ? '' :
137- < div style = { { clear : 'both' } } className = 'reactPivot-soloDisplay' >
138- < span className = 'reactPivot-clearSolo' onClick = { this . clearSolo } >
139- ×
140- </ span >
141- { this . state . solo . title } : { this . state . solo . value }
142- </ div >
143- }
138+ { Object . keys ( this . state . solo ) . map ( function ( title ) {
139+ var value = self . state . solo [ title ]
140+
141+ return (
142+ < div
143+ style = { { clear : 'both' } }
144+ className = 'reactPivot-soloDisplay'
145+ key = { 'solo-' + title } >
146+ < span
147+ className = 'reactPivot-clearSolo'
148+ onClick = { partial ( self . clearSolo , title ) } >
149+ ×
150+ </ span >
151+ { title } : { value }
152+ </ div >
153+ )
154+ } ) }
144155
145156 < PivotTable
146157 columns = { this . getColumns ( ) }
@@ -178,7 +189,11 @@ module.exports = React.createClass({
178189 var filter = this . state . solo
179190 if ( filter ) {
180191 calcOpts . filter = function ( dVals ) {
181- return dVals [ filter . title ] === filter . value
192+ var pass = true
193+ Object . keys ( filter ) . forEach ( function ( title ) {
194+ if ( dVals [ title ] !== filter [ title ] ) pass = false
195+ } )
196+ return pass
182197 }
183198 }
184199
@@ -216,14 +231,21 @@ module.exports = React.createClass({
216231 } ,
217232
218233 setSolo : function ( solo ) {
219- this . props . eventBus . emit ( 'solo' , solo )
220- this . setState ( { solo : solo } )
234+ var newSolo = this . state . solo
235+ newSolo [ solo . title ] = solo . value
236+ this . props . eventBus . emit ( 'solo' , newSolo )
237+ this . setState ( { solo : newSolo } )
221238 setTimeout ( this . updateRows , 0 )
222239 } ,
223240
224- clearSolo : function ( ) {
225- this . props . eventBus . emit ( 'solo' , null )
226- this . setState ( { solo : null } )
241+ clearSolo : function ( title ) {
242+ var oldSolo = this . state . solo
243+ var newSolo = { }
244+ Object . keys ( oldSolo ) . forEach ( function ( k ) {
245+ if ( k !== title ) newSolo [ k ] = oldSolo [ k ]
246+ } )
247+ this . props . eventBus . emit ( 'solo' , newSolo )
248+ this . setState ( { solo : newSolo } )
227249 setTimeout ( this . updateRows , 0 )
228250 } ,
229251
0 commit comments