I'm creating a scheduler with two resource columns, one with the driver name and the other one with the vehicleId
For the vehicle I'm using a template to display the vehicle name and plate, I've created a combo, my question is, how can I update the info on the cell with the new selected vehicle?
Currently this is what I have:
columns: [
{
text: 'Name',
field: 'name',
flex: 1,
editor: false
},
{
text: 'Vehicle',
field: 'vehicleId',
width: 130,
htmlEncode: false,
renderer: ({ value, record }) => `
<div class="grid-resource-vehicle">
<div class="grid-resource-vehicle__text">
${record.vehicleName}
<small>${record.vehicleType}</small>
</div>
</div>`,
editor: {
type: 'combo',
items: [],
editable: false,
onChange: function (value) {
const newId = value.value
const items = value.source._store._data
const newVehicle = items.find(function (item) {
return item.data.id === newId
})
console.log('Resource change', value, newVehicle)
},
listItemTpl: item => `<div>${item.name} - ${item.vehicleType}</div>`
}
}
]