[cells-devel] another redundant update

Andy Chambers achambers.home at googlemail.com
Mon Apr 7 20:42:06 UTC 2008


Hi,

This was mentioned a while ago and is causing a problem now.  When an
ajax request comes in, one of the things that gets updated is the
input value.  For example...

old: <input name="term" value=""/>

...user types in "progv" and hits TAB

new: <input name="term" value="progv"/>

We want the model on the server to update itself to reflect this
change but we don't need to send it down to the browser because the
browser already knows.  The problem this is causing (and this is
something we'll need to take a mental note of for the future) is that
the event binding for the input element is lost when that element is
replaced.  That means any actions after the first don't trigger an
ajax request.

We could rebind the event on the new element but I think its better
not to send it in the first place.

I think this would apply to all UI elements so if that's the case, the
solution is probably to filter updates containing these elements the
same way that ascendant and redundant nodes get filtered in the code
below.

				  (let ((updt (loop for (h . xh) in (updates self)
						 unless (loop for (h2 . nil) in (updates self)
							   thereis (unless (eq h h2)
								     (when (fm-ascendant-p h2 h)
								       (trc nil "suppressing redundant" h :seeing-ascendant h2 (id h2))
								       t)))
						 collect xh)))

I've pushed a new version out to the repo but haven't dealt with this
problem yet.

Another thing you might notice if you look at commented out code in
the example is that the radio button at the bottom seems a bit
verbose.  Radiobuttons could probably do with a layer on top providing
a nicer way of creating them.  At the moment, user code has to create
labels, manage the checked/unchecked status, and the value for each
input.  It should provide something like celtk's mk-radio

--
Andy



More information about the cells-devel mailing list