Select lines in a table

Can anyone share a code for highlight all the lines selected in a table? Just like the image below show?