I'm having trouble managing the inline edit mode in my TreeList.
I would like to enable the inline edit mode (.Editable(e => e.Mode("inline"))) only on nodes without children, so I tought that, fired the "edit" event and checked for the presence of children, I could cancel it using preventDefault() but it's doing nothing.
I searched a lot but couldn't find anything helping me whit this issue.
Bonus question: is it possible, in inline mode, to enable the edit function only for one column?
Thanks a lot!
5 Answers, 1 is accepted
The described result is expected because the edit event is fired after the row is already in edit mode. An option will be instead of using prevent default to call cancelRow method but this could cause a small flickering:
Also, I can suggest submitting a feature request for an event beforeEdit similar as in the Grid:
As for the editable column, this could be set inside the model configuration by setting the column editable property to false for all column that will not be editable:
I hope this is helpful.
thanks for the help.
I solved successfully the single field editable property, but "cancelRow" event is still bothering me.
This is my TreeList:
And this are my simple JS functions used to manage Save and Edit events:
The problem is that when it fires "cancelRow()" I lose focus on the TreeList and I get this error in the console:
Any idea what's the reason?
I'm glad to hear that the first functionality is implemented.
As for the cancelRow, I made an example demonstrating the same approach and it is working as expected on my end:
If possible, please provide an example demonstrating the issue as it could be caused by a factor which we are overlooking at this moment.
thanks to some testing and another Admin, we discovered that the problem is in the specific use case of a TreeList whit inline edit and no Edit button.
The edit event, triggered by the Enter or Alt+F2 key (as documented HERE), has some timing issues, causing the wrapper not be found.
The temporary solution, waiting for the ticket 4306 to be closed, is to wrap the cancelRow call inside a setTimeout function.
While replying i cut out the end:
I hope that this post could be useful to someone else in order to solve the same or maybe a similar problem.
Thank you so much Stefan for you support!