|
this.dpParams = {
create: () => { // It is used to create the element at time of initialization
this.elem = document.createElement('input');
return this.elem;
},
read: () => { // It is used to read the value from component at time of save
return this.multiSelectObj.value.join(','); //while saving the record convert the array value as string
},
destroy: () => { // It is used to destroy the component.
this.multiSelectObj.destroy();
},
write: (args: { rowData: object, column: any }) => { //It is used to create custom component or assign default value at time of editing
let tempVal = args.rowData[args.column.field] ? args.rowData[args.column.field].split(',') :[]; //at the time of Editing convert the string value to array because multiselect supports the array value only
this.multiSelectObj = new MultiSelect({
value: tempVal,
dataSource:this.multiselectDatasource,
fields: { value: 'Country',text:'Country' },
floatLabelType: 'Never',
mode:'Box'
});
this.multiSelectObj.appendTo(this.elem);
}
}; |