Cardiff moved to the top of the Championship table with a 2-1 victory at Oakwell that heaped more misery on struggling Barnsley.