When sorting is broken, the only solution is to disable it. You can choose the “NO SORTING” option in all your windows and then you will have the most hassle-free inventory option.
If you try other sorting options, you will add problems to the simple solution.
An attempt to transfer an item with different sorting options in the left and right windows will most likely result in an error activation.
My experience tells me that the selected sorting options are just a displayed mask, but you will be shown blank slots with items that are not actually there.