Close window with datagrid

Hi, How can I to detect data modifications on grid before closing window? There is any flag for it? Thank you very much

Loader.
Up arrow icon