Welcome Guest, Not a member yet? Register   Sign In
Filtering calendar results
#1

[eluser]Unknown[/eluser]
Hi -

I'm using the CodeIgniter calendar class and populating the calendar from a database with multiple results on same day and that's working fine. Then I have dropdowns that filter the data, these are going through jquery/ ajax and they work, except they only work on the current month. The calendar class uses the url to change month:

Code:
$prefs = array(
   'show_next_prev' => true,
   'next_prev_url' => base_url() . 'index.php/calendar'
);


So when I go from one month to the next it unfilters the data.
To spit out the calendar I need:

Code:
$data['calendar'] = $this->calendar->generate($year, $month, $cal_data);

Right now I'm passing the $year and $month to the view and sending it through jquery/ ajax, (along with the variable I need to run the query with) that way it doesn't reset to the current month. But I'm stuck on how to keep the current $cal_data when the month changes.

My query is using the current month also, because it was showed all the results every month unless I did it like:

Code:
$this->db->where('date >=', date('Y-m-d'));
$this->db->where('month(date)', $month);

That shouldn't matter though, right? Because once it calls the original controller, that calls the model that queries the data without a filter...
#2

[eluser]TheFuzzy0ne[/eluser]
Sorry, I don't understand what it is you're trying to achieve. Why do you need to keep $cal_data at all?




Theme © iAndrew 2016 - Forum software by © MyBB