hopefully this is not a duplicate but I haven't been able to find any solution.
What I am looking for is a way to modify the new value when the 'save' event is fired. In my scenario there are several rows in the grid representing order positions. The user should now enter the amounts which are going to be shipped so he then can get a delivery note. So when the user enters an amount larger than initial the ordered one he should be warned and asked if he really wants to ship more. If denied the value should be set to the ordered amount.
I've tried several ways by modifiying the e.values or the e.model property. With or without a grid.refresh()... no way to modify the new value.
Finally I just define a e.preventDefault() but don't really like it.
Does anyone knows how to achieve my goal? Many thanks in advance!!
4 Answers, 1 is accepted
Can you please provide additional information on your exact requirement and more precisely how you are binding your RadGrid and what edit mode you are using.
Furthermore, if you can provide the markup and the relevant code-behind of your page we will have a better idea of the exact scenario.
Looking forward to your reply.
I appreciate your support. Here comes the code - it's from my ASP.NET MVC application so there is a little bit R@zor-syntax in it.
So basically I'm checking in line 77 the new value if it is more than a specific value. If so I ask the user whether this is by accident or not.
The whole grid is placed inside a kendo-window. Currently I've tow guesses:
1) The messagebox blurs the control so the event-chain is not correctly running
2) By accident I stumbled over an issue that model.set('<key>', value) seems not to have the same effect than model.key = value.
Unfortunately I'm on vacation the next week so my next answer will take some time.
Many thanks in advance!!
Calling the eve.preventDefault() should prevent saving values by the datasource component. Additionally if you want to play with the data directly you need to mark the records you changes as dirty and call the sync method:
Please give it try and let me know if it helps you.
Looking forward for your reply.
finally I'm back from vacation and have been able to take another look. And I've found the issue in my code:
Setting the value via
will fail to update the GUI. When setting it directly in the model by
the GUI updates as desired.
Strange as I would think that both ways should be the same...