I think we can divide this sentence into three parts:
こんなこと / があって /たまるか
Something like this / happening（あるー＞あって、te-form)/ tolerate(endure)?
where the か in the end of the sentence is a mark of a rhetorical question.
So in summary, we have literally:
It cant be tolerated that something like this is happening (So I am gong to stop it!)
This sentence can be used when you see something that you strongly disagree with is happening, and you are about to do something to change it.
Forたまる, it is 堪るhere, which means to endure.
I am learning Japanese as well. Please forgive me if I am wrong and let me know. It will be of great help. Thank you.