The court shall order all or any of the issues in a civil action, whether of fact or law, or both, referred to a referee upon the written consent of the parties which is filed with the clerk. Any party shall have the right in an action at law, upon an issue of fact, to demand a trial by jury. No referee appointed under this chapter may preside over a jury trial. The written consent of the parties constitutes a waiver of the right of trial by jury by any party having the right.