WidgetColumn
A column that displays one or more widgets in the grid cells.
When rendered into a cell, all widgets will have a special cellInfo context property injected into them so that event handlers can ascertain the context in which they are operating.
new Grid({
columns : [{
type : 'widget',
widgets : [{
type : 'button',
menuIcon : false,
icon : 'fa fa-ellipsis-v',
menu : {
type : 'menu',
items : {
viewResponses : {
icon : 'fa fa-fw fa-file-signature',
text : 'View Responses'
},
clearConsent : {
icon : 'fa fa-fw fa-times-circle',
text : 'Clear Consent',
},
surveyList : {
icon : 'fa fa-fw fa-file-signature',
text : 'Survey List (Read-Only)'
}
},
// Method is called for all descendant levels.
// 'up.' will find it defined on the Grid.
onItem : 'up.onWidgetColumnMenuClick'
}
}
}],
onWidgetColumnMenuClick({ source }) {
// Find the source widget's Button ancestor. It's the cell widget.
// A WidgetColumn's cell widget gets a cellInfo property injected
const { cellInfo } = source.up('button');
console.log(`Clicked ${source.ref} on ${cellInfo.record.name}`);
}
});
Data binding to fields
If you use Fields inside this column, the field widget can optionally bind its value to a field in the data model using the name (shown in the snippet below). This will provide two-way data binding and update the underlying row record as you make changes in the field.
new Grid({
columns : [{
type : 'widget',
widgets : [{
type : 'numberfield',
name : 'percentDone'
}]
}]
});
If you use a Button and want it to display the value from the cell as its text, set its defaultBindProperty to 'text':
new Grid({
columns : [{
type : 'widget',
widgets : [{
type : 'button',
name : 'age',
defaultBindProperty : 'text'
}]
}]
});
There is no editor provided. It is the configured widget's responsibility to provide editing if needed.
Useful configs
| Config | Description |
|---|---|
| widgets | Array of widget configs to render in each cell |
See also
- CheckColumn - Specialized checkbox widget column
- Column - Base column class
- cellInfo - Context injected into cell widgets
No results
Configs
Configs are options you supply in a configuration object when creating an instance of this classProperties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of WidgetColumn class, or subclass thereof.
-
Identifies an object as an instance of WidgetColumn class, or subclass thereof.
Functions
Functions are methods available for calling on the classtype: widget