On Feb 12, 1:51 pm, "Scott L. Burson" <[email protected]> wrote: > Basically, what you want for this is ON-DEMAND-SELECTOR. Here's some > sample code from the app I'm writing: > > (defwidget proposal-selector (on-demand-selector) > () > (:default-initargs :lookup-function 'proposal-selector-lookup)) > > (defun proposal-selector-lookup (selector tokens) > (declare (ignore selector)) > #.(locally-enable-sql-reader-syntax) > (multiple-value-prog1 > (and (= (length tokens) 1) > (let ((id (handler-case > (parse-integer (car tokens)) > (parse-error () nil)))) > (and id > (let ((proposals (select 'proposal :where [= [id] id] > :flatp t))) > (and proposals > (values (make-view-proposal-widget (car proposals)) > tokens nil nil)))))) > #.(restore-sql-reader-syntax-state))) > > (defun make-view-proposal-widget (proposal) > (make-widget > (list (lambda (&rest args) > (declare (ignore args)) > (render-object-view proposal (find-view > 'proposal-public-view)))))) > > This is using integer id's; it does the conversion and calls > CLSQL:SELECT to pull the proposal out of the DB. (Ignore the > weird-looking SQL syntax stuff if you don't recognize it; it's > CLSQL-specific.)
I thought I replied to this but I'm not seeing it here. This will work for me, thanks! I am having a little trouble understanding how to have a navigation and this on-demand selector at the root. I have tried to combine them in various ways but it seems I am missing something. The lookup function for the selector is getting the tokens for the navigation. Any idea what I'm doing wrong here? Here is the code: http://paste.lisp.org/display/119641 Thanks again! Anthony -- 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.
