Class Banana.Controls.DataGrid
Defined in: Datagrid.js.
Constructor Summary
new Banana.Controls.DataGrid
()
Creates a datagrid A datagrid is a more advanced list control with functionality to have its own listrender.
Method Summary
setDataSource(datasource)
setEmptyTemplate(c)
An empty template is shown when no datasource or empty datasource is inside the datagrid.
Constructor Detail
new Banana.Controls.DataGrid()
Creates a datagrid
A datagrid is a more advanced list control with functionality to have its own listrender.
A listrender is responsible for rendering the list and is completely independent from the datagrid itself.
By default a datagrid is having a table list render .
A different listrender can replace the current listrender if desired at anytime.
Empty template can be assigned to a datagrid which is shown when there is no data inside the
datagrid.
Example:
var datagrid = new Banana.Controls.DataGrid();
var columns = [
new Banana.Controls.DataGridColumn().setHeaderText('name').setDataField('name'),
new Banana.Controls.DataGridColumn().setHeaderText('description').setDataField('description')
];
datagrid.getListRender().setColumns(colums);
var datasource = [
{'name':'a name1','description':'a description1'},
{'name':'a name2','description':'a description2'},
{'name':'a name3','description':'a description3'}
];
datagrid.setDataSource(datasource);
this.addControl(datagrid);
Method Detail
setDataSource(datasource)
: this
Parameters:
{mixed} | datasource | to fill the datagrid with |
Returns:
{this} |
setData(data)
: this
setData method is equal to the setDataSource method. This method is used
when datagrid is binded to data in a dataset.
Parameters:
{mixed} | data |
Returns:
{this} |
setControlPanel(c)
: this
add a control panal above the datagrid.
A control panel is used as a container for filters and other controls interacting
with the datagrid.
Parameters:
{Banana.Controls.DataGridControlPanel} | c |
Returns:
{this} |
getControlPanel()
: Banana.Controls.DataGridControlPanel
Returns:
{Banana.Controls.DataGridControlPanel} |
setEmptyTemplate(c)
: this
An empty template is shown when no datasource or empty datasource is inside the datagrid.
Parameters:
{Banana.Controls.UiControl} | c |
Returns:
{this} |
setListRender(lr)
: this
Sets the list render responsible for rendering content.
If changed during runtime we rerender the complete datagrid.
Parameters:
{Banana.Controls.Banana.Controls.DataGridBaseListRender} | lr |
Returns:
{this} |
getListRender()
: Banana.Controls.DataGridBaseListRender
returns current active list render. If none is active we return a default table list render
Returns:
{Banana.Controls.DataGridBaseListRender} | listRender |