First, when the door is fully extended (closed), see if you can locate the rear trolley and bring it forward using a flashlight & coathanger or other wire. If you can, you have a chance of being able to reattach the door without removing trim.
If this isn't possible, you will have to remove some trim; probably the casing and jamb extension from the top and pocket side of at least one side of the doorway. Then proceed as above, locating the trolley and bringing it forward where the door can be reattached. Once it's reattached, depending on the type of attachment, you might be able to wrap a couple loops of wire through the loop on the trolley hook to prevent the door from unhooking in the future. Good Luck