Data Moving Plug-in Mvc Controls

All Data Moving Plug-in controls work both on mouse based and on touch based devices. Most of controls may work both as server controls and as client controls. The only exceptions are the TrackedServerGrids that work only as server controls, and the TreeView/TreeGrid that works only as client control.

Data Moving Plug-in simpler controls are rendered with helpers similar to the TextBoxFor, HiddenFor, etc. standard Asp.net Mvc helpers:

@item.LinkFor(m => m.Text, m => m.Text, 
  new { target=item.ViewData.Model.Target, tabindex="0"})

More complex controls use a fluent interface to specify all options:

@item.DualSelectExtFor(m => m.Categories)
    .ImportDefault(DefaultScope.Named, "DetailDualSelect")
    .ContainerHtmlAttributes(new { @class = "dual-select-column" })
    .ControlAttributes(new { data_role_default = "0" })
    .Render(item.CreateChoiceList(m => m.AllCategories,
                                  m => m.Id, m => m.Description))

The Last instruction  always is  .Render(....) that renders the control.

Controls used to render collections, like Grids and TreeViews/TreeGrids, are called Items Controls, and their fluent interface is based on the concepts of RowTypes, and Columns. Each RowType encodes a different way of handling and rendering the control data. A single control may define sevral RowTypes, either because  it renders several nested collections, as the TreeView/TreeGrid, or because different data of the same collection may be rendered in different ways. In the last case the developer must provide a RowType selection function that selects the right RowType for each data item. The RowType selection function is a .Net function for server controls and a javascript function for client controls.

RowTypes and Columns are used to define both toolbars and the items bound to data. Columns may be configured to allow the user to change their width with the mouse (or with fingers, in case of touch devices). Both RowTypes and Columns have several default templates that may be selected with their fluent interfaces, but the user may provide also custom templates for both of them.

Below the definition of an Items Control, based on both Control and Row prototypes:

@{var dBuilder = Html.SimpleGrid(m => m.Directory, DefaultScope.Named,"StandardStaticGrid")
    .Parameters("Customers Directory")
      .AddColumn(t => t.Name, canAdjust: true, width: 90, minWidth: 90)
      .AddColumn(t => t.Surname, canAdjust: true,
                 width: 110, minWidth: 90)
      .StartColumn(t => t.EMail).DeclareHidden().EndColumn()
      .StartColumn(t => t.Address).DeclareHidden().EndColumn()