Fred <[email protected]> writes: > Hello, > > thanks for your help. > > class-store slot is the answer i'm looking for. > > I do not need to create my own store, > instead i use memory store : > (make-instance 'weblocks-memory:memory-store)
Ah, yes that should work to. > A let to create this new store within each new session > and to use it with my "search widget" and the quickform. > > Please watch the code here below : > > (defwidget ldap-search-widget () > ((view :accessor ldap-s-view > :initform 'ldap-search-view > :initarg :view > :documentation "A form view for an LDAP search") > (search-store :accessor search-store > :initform nil > :initarg :search-store) > (quickform :accessor ldap-quickform > :initform nil > :initarg :quickform))) > > (defun make-main-page () > (let ((search-and-results (make-instance 'weblocks-memory:memory-store))) > (make-instance 'composite :widgets > (list > (make-instance 'ldap-search-widget > :search-store search-and-results) > > (make-instance 'datalist > :name 'ldap-people > :class-store search-and-results > :data-class 'ldap-people > :item-data-view 'ldap-people-data-view) > > > (defmethod initialize-instance :after ((obj ldap-search-widget) > &rest initargs > &key &allow-other-keys) > (declare (ignore initargs)) > (setf (ldap-quickform obj) > (make-quickform (ldap-s-view obj) > :class-store (search-store obj) > :on-success (lambda (w o) > (declare (ignore w)) > (clean-ldap-results-store > (search-store obj)) > (search-people (slot-value o 'name) > (search-store obj)) > (mark-dirty (widget-parent obj)) > (answer obj)))) ) > > > Every new search (on-success lambda), > get results and mark dirty > the parent widget, but is this lambda the right place > to use mark-dirty ? In my opinion, yes, the lambda is the right place. The only thing I would consider changing is the target of the mark-dirty. You could give the ldap-search-widget an ivar, result-widget and store in that ivar your datalist widget. In that case in the lambda you can write (mark-dirty (result-widget obj)). However, your way or what I suggest above, are so similar that it does not really matter. The only slight advantage I can see with what I propose is that you do not have to put the ldap-search-widget together with the datalist widget in one parent widget. It will give you the freedom to put the results in a complete different place in the widget tree. Kind regards, Wim Oudshoorn. -- 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.
