Support Forum
ok
first of all can i achieve a functionality like can i have last column with edit and save button for each row like as in attached jped "template column with icons". ?
if yes please suggest some approach .
also i was trying to create a template with onClick event to capture the click on template column
we have widgets with onClick events
can i have such onClick event with template column too , if not can i specify " widgets : [{
type : 'button'," this type button to be instead of type icon maybe?
first of all can i achieve a functionality like can i have last column with edit and save button for each row like as in attached jped "template column with icons". ?
if yes please suggest some approach .
also i was trying to create a template with onClick event to capture the click on template column
{
type: 'template', flex: 0,width:10, resizable: false, template: () => `
<button class="btn"><i class="fa fa-save"></i></button>`
}
{
type : 'widget',
field : 'city',
text : 'WidgetColumn',
width : 140,
widgets : [{
type : 'button',
cls : 'b-raised',
text : 'Hello',
onClick : ({ source : btn }) => {
const { record } = btn.cellInfo;
Toast.show(`Hello ${record.name} from ${record.city}`)
}
}]
type : 'button'," this type button to be instead of type icon maybe?
- Attachments
-
- template column with icon.jpg (17.39 KiB) Viewed 1233 times
You can use cellclick event on the grid.
You might want to configure column to be readonly, to allow fast clicking
Also if you want to wrap code you can use code tag (in brackets)
new Grid({
listeners : {
cellclick : ({ grid, record, column, target, event }) => {
console.log(target); // logs clicked button
}
}
})
{
type: 'template',
flex: 0,
width:10,
resizable: false,
editor: false,
template: () => `
<button class="btn"><i class="fa fa-save"></i></button>`
}