We have just upgraded from version 10 to 14. In the process, we discovered that although the grid's crud service still returns true if the end cell editing event is cancelled, this return value is not passed back in the grid's endEdit method.
Knowing whether or not end cell editing has been cancelled is a critical part of our application's functionality. We absolutely cannot let the user proceed with other operations (navigating away from the page, printing the records, etc) if the cell is still in edit mode and the user's changes have not been persisted.
Please restore the return value for endEdit as soon as possible
I have been looking into your question, however, I'm not sure I understood your requirement completely.
I have tested the behavior of the grid when the cellEdit event is canceled and the page is changed in both version 10 and 14. The observed behavior in version 10 is that the edited cell remains in the view, however, the rest of the fields are not from this row.
In version 14 when the page is changed the cell exits edit mode and the changes are not committed. However, preventing certain interactions could be achieved on application level. Since the event is canceled on some conditions through the code, an approach I could suggest is to store the event.cancel value in a global variable and then you could prevent the required actions depending on this value.
For example, I have prepared a sample where paging is prevented when the cellEdit event is canceled via the paging event and it could be found here.
Using a similar approach you could prevent other actions based on the same global variable.
Please test the sample above on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce.
Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.
Thank you for your cooperation.
Looking forward to hearing from you.
Regards,Teodosia HristodorovaSoftware Developer
Sorry, it appears that the problem has been misunderstood.
This is not about what happens in the grid UI, it is about what happens when I programatically ask the grid to end editing using grid.endEdit() method.
In previous releases, this method would return true if the endCellEditing event was cancelled. This event can be cancelled for any number of reasons including validation failure.
We must ask the grid to end editing in numerous circumstances such as when a user wants to print a report. If the end edit request is cancelled and just prints the report without saving the value of the cell they are currently editing, then the information in the report will not match what the user is seeing on the screen which could potentially result in a significant financial error for the customer.
What we are asking for is the restoration of the return value to grid.endEdit in the event the endCellEditing event is cancelled.
After further investigation, I could say that the endEdit method of the grid is from type void in both versions 10 and 14 as you could see in our API documentation. However, in version 10, it indeed returns the same value as the cellEdit cancel event argument. My assumption is that since this behavior was not intended for public use in the newer versions the actual implementation of this method is moved to the grid's CRUD Service which is accessible but not publicly exposed.
In addition, I was not able to find a cancelable endCellEditing event in version 14 and as it is mentioned in this topic the cancelable events related to the editing are cellEditEnter and cellEdit. However, in both cases, the event is canceled manually through the code under certain conditions which are known to the developer and since previously the grid endEdit method returns the same value as the cellEdit cancel event argument, you could store its value in a global variable as I previously suggested and use it instead of the method.
If this suggestion does not help in resolving the issue, it would be useful if you could provide more details about your scenario, the required behavior and when calling endEdit method is necessary in order to achieve the desired behavior. Also, it would be helpful if you could modify the previously provided sample in order to reproduce the issue and send it back as well as steps to reproduce so I could investigate if there is a different approach to achieve your requirement.
Thank you for your cooperation.
Sincerely,Teodosia HristodorovaSoftware Developer
Unfortunately the documentation that you are referencing is not correct for version 10.2.18, which is what we are migrating from.
And yes, the cancellable event that I was referring to is cellEdit (we have used Infragistics jQuery grid for a very, very long time so I sometimes get the event names crossed up).
Yes, this functionality is still absolutely necessary for our application. I have outlined several of the use cases where it is critical to the correct operation of our application in the initial request and subsequent responses, so I don't think I should have to lay them out again. But in short, if the user performs an action elsewhere in the page, we must be able to programatically end editing and cancel if the ending of editing was not successful.
We have used this exact functionality in both jQuery and now the angular grid and we have been using the jquery grid for at least 10 years now (most likely more than that).
This is not just a simple complaint, it is a critical aspect of our high-end production application.
I have modified the previously provided sample in order to demonstrate how you could end the editing when the page is changed and commit or not the changes based on whether the cellEdit event is canceled.
In order to achieve this behavior I'm storing the event cancel argument in a global variable.
Using a similar approach you could end the cell editing on other interactions.
Here could be found my sample for your reference. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce.