Bug Fix #4417,#4403: Single-clicking a foreign key causes JavaScript error

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>
Merge pull request #1184 from D-storm/bug-4417

Bug Fix #4417,#4403: Single-clicking a foreign key causes JS error