Open main menu

CDOT Wiki β

Changes

8. Implement Edit Student Option
8.4. So far we added the Edit Menu option to the app, but it will not work as we have to modify the execute() method of it's CommandHandler. We want to add a Modal Screen which has editable fields for student first name , last name and email, and Save and cancel Buttons. Here is the code to achieve that:
 
First we need a method in <code>ViewStudentApp</code> class, which updates student list and refreshes the view:
<pre>
void editListElement(Student studentOld, Student studentNew){
_studentList.elementUpdated(_studentList, studentOld, studentNew);
_keywordFilterField.updateList();
}
 
</pre>
 
Then we need to modify the execute() method of the editItem's CommandHandler:
 
<pre>
public void execute(ReadOnlyCommandMetadata metadata, Object context) {
1
edit