I think the problem may be a circular dependency; as soon as you switch the data source, the source now references the table’s data…which is now the table’s data (etc).

Instead of setting that data source to the table’s data, can you try setting the data just like it is prior to the sort, and add the sort on top of that?