Handling dirty (modified) text input fields in ExtJS
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question:I am working with ExtJS - how can I detect if a field has been modified in a dynamic form? I have a master table and a detail panel where I show details for the selected record in the master table.
Answer:You can check if the entire panel or individual fields are empty by querying the isDirty() function.
But when the changes have been saved, you may want to reset this flag. I found that there is some method clearDirty() and a related flag trackResetOnLoad but I could not make it work.
After some experimenting, I wrote my own resetDirty() function - see below. I call it after modified text values have been saved back to the database.