loop through rows in a model

one more question would you know how to close the popup from the javascript snippet?