addView

adds a new view to a dashboard

string|number addView(object view, [number index] );

Parameters

viewobjectthe configuration of the new view
indexnumberthe index a new view will be added at

Returns

string|numberthe id of the new view

Example

webix.ui({
    view:"dashboard", 
    id:"grid",
    gridColumns:4, gridRows:3,
    cells:[
        { view:"panel", x:0, y:0, dx:1, dy:1, body:{
            template:"Single"
        }},
        { view:"panel", x:1, y:0, dx:2, dy:1, body:{
            template:"Wide 1"
        }},
        // more columns
    ]
});
 
$$("grid").addView({view:"panel",x:1, y:1, dx:1, dy:1, body:{template:"Column1"});

Related samples

Details

A Dashboard cell possesses its attributes from a GridLayout cell, namely:

  • x - (number) the x-index of a grid cell starting point
  • y - (number) the y-index of a grid cell starting point
  • dx - (number) the width of a view defined as a number of grid cells
  • dy - (number) the height of a view defined as a number of grid cells

The "widget" view may have the following attributes:

  • body - (object) the body of a "panel" view to place a template of a view inside
  • icon - (string,boolean) defines whether a drag handle icon is displayed. The default value is "bars"
  • resize - (boolean) defines whether a view is resizable (has a resize handle), false by default
  • header - (string) sets a header with the specified text for a view
See also
Back to top