Replace while with for loop in Detail Page

Change-Id: I5c41b558890f5d9b86bf1e99a971f8787f23bb17
Signed-off-by: Chloe Xu <chloe.xu@sap.com>