- Home
- Forum
- Angular - EJ 2
- Enable edit with keyboard and hitting in enter in edit mode doesn't update the value
Enable edit with keyboard and hitting in enter in edit mode doesn't update the value
this.valueEditOptions = {
create: () => {
this.valueSourceElem = document.createElement('input');
return this.valueSourceElem;
},
read: () => {
return this.valueComponent.value;
},
destroy: () => {
this.valueComponent.destroy();
},
write: (args: { rowData: BaselineRow, column: Column }) => {
if(args.rowData.definition.rowType === BaselineRowType.Node_Content){
const matSet = args.rowData.definition.allowedMaterials;
this.valueComponent = new ComboBox({
dataSource: matSet,
sortOrder: 'Ascending',
value: args.rowData.definition.material,
cssClass: 'scs-cell-editable',
showClearButton: false,
});
this.valueComponent.focus = () => {this.valueComponent.showPopup()};
}
if(args.rowData.definition.rowType % 2 !== 0 ||
args.rowData.definition.rowType === BaselineRowType.Material_Component_Value){
//String type
if(args.rowData.propertyUnit.includes("String")){
this.valueComponent = new TextBox({
value: args.rowData.propertyValue+'',
});
}
//Numeric type
else{
this.valueComponent = new NumericTextBox({
value: <number>args.rowData.propertyValue,
showClearButton:false,
showSpinButton: false,
step: 0,
})
}
}
this.valueComponent.appendTo(this.valueSourceElem);
}
}
|
// HTML page
// TS Page |
|
ngOnInit(): void {
this.valueEditOptions = {
.........
read: () => {
return this.valueSourceElem.value; //return the edited text value here
},
..........
}
} |
Hi
Gowri Loganathan,
I have the exactly same issue as mentioned in above query :
Query: With TextBox and NumericTextBox when hit enter leaving edit mode the values doesn't not update. But when I click outside yes.
I have tried doing the same as you mentioned to fix the issue by picking the value from valueSorceElem.value, the value is shown by pressing enter now but I don't get the updated value after I click again and change event is not called on pressing enter as well.
Looking forward.
Umer Farooq
Hi Umer Farooq,
Query#:- the value is shown by pressing enter now but I don't get the updated value after I click again and change event is not called on pressing enter as well.
We have checked your reported problem by preparing sample but we are unable to replicate the problem at our end(on clicking the update Icon as well as pressing the Enter). Change event will only trigger on changing the value using the icons. It will not trigger on pressing Enter key. Refer to the sample link:-
https://stackblitz.com/edit/angular-bjvuwp?file=app.component.html,app.component.ts
Screenshot:-
We need some more additional details to find the cause of the issue. Share us the following details.
- Complete TreeGrid code details.
- Video Demo to replicate the problem.
- If possible replicate it in the above sample and revert us back.
- Share exact requirement you need to achieve.
Regards,
Farveen sulthana T
Thanks Farveen Sultana,
I have achieved the required event trigger by explicitly calling the fousOut() method in read callback. So it triggers the change callback on enter and Tab press now.
Regards,
Umer
Hi Umer,
Thanks for the update.
We are glad to hear your query has been solved.
Regards,
Pon selva
- 10 Replies
- 6 Participants
- Marked answer
-
CS Cesar Smerling
- Aug 14, 2020 06:35 PM UTC
- May 23, 2022 02:53 PM UTC