public ActionResult Index(FormCollection data) { var sched = new DHXScheduler(this); sched.Extensions.Add(SchedulerExtensions.Extension.Cookie); var rooms = new DHXSchedulerDataContext().Rooms.ToList(); int selectedRoom; if (this.Request.QueryString["filter"] != null) { // parameters will be added to data url sched.Data.Loader.AddParameters(this.Request.QueryString); selectedRoom = int.Parse(this.Request.QueryString["rooms"]); } else { selectedRoom = rooms.First().key; } var unit = new UnitsView("rooms", "room_id"); unit.Label = "Rooms"; unit.AddOptions(rooms); sched.Views.Add(unit); sched.Lightbox.AddDefaults(); var select = new LightboxSelect("room_id", "Room"); select.AddOptions(rooms); sched.Lightbox.Add(select); sched.LoadData = true; sched.EnableDataprocessor = true; sched.InitialView = unit.Name; ViewData["rooms"] = selectedRoom; sched.InitialDate = new DateTime(2011, 9, 7); return(View(new SchedulerFilterModel(sched, rooms))); }
/// <summary> /// applying client side filters for each view /// </summary> /// <returns></returns> public ActionResult Index() { var scheduler = new DHXScheduler(); var rooms = new DHXSchedulerDataContext().Rooms.ToList(); //each view can have multiple rules //they also can be added on the client scheduler.Views[1].Filter.Rules.Add(//month new Rule("start_date", Operator.GreaterOrEqual, new DateTime(2011, 9, 6)) ); scheduler.Views[1].Filter.Rules.Add( new Rule("end_date", Operator.LowerOrEqual, new DateTime(2011, 9, 14)) ); scheduler.Views[2].Filter.Rules.Add(//day new Rule("room_id", Operator.Equals, rooms.First().key) ); scheduler.Views[2].Filter.Rules.Add(//day new ExpressionRule("{text}.length > 4 && {text}.length < 20") ); var select = new LightboxSelect("room_id", "Room"); select.AddOptions(rooms); scheduler.Lightbox.AddDefaults(); scheduler.Lightbox.Add(select); scheduler.Controller = "BasicScheduler";//using BasicSchedulerController to load data scheduler.LoadData = true; scheduler.InitialDate = new DateTime(2011, 9, 7); return(View(scheduler)); }