Units view

Initialization

public ActionResult Index() {
    var sched = new DHXScheduler(this);
    ...
    var unit = new UnitsView("unit1", "room_id");//initializes the view
    sched.Views.Add(unit);//adds the view to the scheduler
 
    return View(sched);
}

where

  • unit1 - the name of the view.
    The constructor requires the 'name' cause the view can exist in the scheduler in several instances.
  • room_id - the name of a property using as the id of units.

Properties

  • Label - (string) the text label. The default value - 'Units'.
  • Name - (string) the name of the view. Applicable just to the Units and Timeline views cause they can be presented in the scheduler in several instances. For other views the property is read-only and names are taken by default.
  • Property - (string) the name of a property by which events are divided to units.
  • Size - (integer) the number of units to be displaying on the screen at a time.
  • SkipIncorrect - (boolean) skips (doesn't display) events which belong to none of the defined units. If the parameter is set to false, such events are presented in the first unit. The default value - false.
  • Step - (integer) the scroll step.
  • TabClass - (string) the name of a css class that will be applied to the tab.
  • TabPosition - (integer) the right offset of the view tab in the tabbar. By default, tabs go right-to-left in the order of addition to the scheduler.
  • TabStyle - (string) the style that will be applied to the tab.
  • TabWidth - (integer) the width of the tab
  • ViewType - (string) the type of the view. The property is read-only.

Data for X-Axis

In general, to set values for the X-Axis you should use method AddOptions().

The method can take 2 types of data:

  • Object of the Unit class (IEnumerable<Unit>)

    unit.AddOption( new Unit("1", "Room 1"));
  • Object of any class inherited from System.Object (IEnumerable<object>)

    var rooms = new List<object>(){
                    new { key = "1", label = "Room 1"},
                    new { key = "2", label = "Room 2"},
                    new { key = "3", label = "Room 3"}
    };
    unit.AddOptions(rooms);

    Note, to be correctly processed data items must have 2 mandatory properties:

    • key - the id of an item;
    • label - the text label of an item.

comments powered by Disqus