multiple drop down categories in wordpress

Hi, I’m using dhtmlxscheduler 3 for wordpress 3.51
I’m trying to allow two drop down boxes to filter the events displayed.
Both dropdowns display correctly, but only the first one works correctly.

The first one is “category” (such as “yard sale”, “community services”, etc.)
That is working fine. Selecting various settings in the dropdown reformats the calendar on the fly. Amazing!

I set up another custom field for “location”, with various nearby cities and villages. However, selecting anything besides “all” in the dropdown gives me a blank calendar.

This is for a free rural events listing, and our geographic area is massive, so being able to filter by location as well as category is pretty essential…

here is the code I put in:

$scheduler .= "
scheduler._filter_by = ‘’;
scheduler.filter_day = scheduler.filter_week = scheduler.filter_month = function(id){
if (!scheduler._filter_by) return true;
if (scheduler.getEvent(id).category == scheduler._filter_by) return true;
return false;
};


All
Community Service
Fun and Games
Yard Sales

         <select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);'>
		 <option value=''>All</option>
		 <option value='location_0'>Everywhere</option>
		 <option value='location_1'>Happy Camp</option>
		 <option value='location_2'>Orleans</option>		 
		 <option value='location_3'>Other</option>		 
		 </select>

This is an amazing plugin!!!
thank you.

I do not see how to edit my first post, so here is an improvement in the code.

Now both drop downs work properly, BUT neither one respects the other. So effectively, the calendar can be filtered by either “Village” or “Category”, but not both.

I’d really like our community to be able to filter by both.
This service is entirely for public benefit and will be free, forever, if that is any motivation :slight_smile:

the code:

$scheduler .= "
scheduler._filter_by = ‘’;
scheduler.filter_day = scheduler.filter_week = scheduler.filter_month = function(id){
if (!scheduler._filter_by) return true;
if (scheduler.getEvent(id).category == scheduler._filter_by) return true;
if (scheduler.getEvent(id).village == scheduler._filter_by) return true;
return false;
};

         <select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);'>
		 <option value=''>All Villages</option>			 
		 <option value='village_0'>Klamath River</option>
		 <option value='village_1'>Scott Bar</option>
		 <option value='village_2'>Seiad Valley</option>		 
		 <option value='village_3'>Happy Camp</option>	
		 <option value='village_4'>Somes Bar</option>
		 <option value='village_5'>Orleans</option>
		 <option value='village_6'>Forks of Salmon</option>		 
		 <option value='village_7'>Weithpec & Hoopa</option>			 
		 </select>
		 

		 
         <select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);'>
		 <option value=''>All Categories</option>
		 <option value='category_0'>Community Service</option>
		 <option value='category_1'>Fun and Games</option>
		 <option value='category_2'>Yard Sales</option>		 
		 </select>

Thank you!