So I have a recursive representation of a directory tree for
navigating files in my weblocks application.  However, when I click on
a directory (to "open" it) that has a decent number of files (50+), I
get a request timed out error.  When I simply go back, the webpage
looks as one would have expected with all the files listed underneath
(tabbed slightly to the right) of the directory.  Below is the
relevant code for classes dir-tree and file:

(defgeneric on-select (widget)
  (:method ((widget dir-tree-widget))
    (when (not (eq widget (current-dir-tree-widget (photo-explorer
widget))))
      (setf (current-dir-tree-widget (photo-explorer widget)) widget))
    (setf (expanded widget) (not (expanded widget)))))

(defmethod render-widget-body ((obj dir-tree-widget) &key)
  (let* ((class (if (expanded obj) "open" "closed"))
         (action (function-or-action->action #L(on-select obj))))
    (with-html
      (:li (:div (:div :class class
                       :onclick (format nil "initiateAction(\"~A\",
\"~A\"); return false;"
                                        action (session-name-string-
pair)))
                 (render-link action (name (dir-tree obj)))))
        (with-html
          (:ul :class class
           (mapcar #'render-widget (children obj)))))))

(defmethod on-select ((file-widget file-widget))
  (let ((photo-explorer (photo-explorer file-widget))
        (parent (parent file-widget)))
    (when (not (eq (current-dir-tree-widget photo-explorer) parent))
      (setf (current-dir-tree-widget photo-explorer) parent))
    (setf (url (photo-viewer photo-explorer)) (url-path (file file-
widget)))))

(defmethod render-widget-body ((obj file-widget) &key)
  (with-html
    (:li (render-link #L(on-select obj)
                      (name (file obj))))))

I originally was simply not outputting the html for any children of
dir-tree if it was not expanded, but switched to simply swapping the
DOM class and letting CSS take care of hiding the children (via
display: none;).  This didn't solve the timeout issue.  What am I
doing wrong here?

Thanks,
John Watson
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to