Wednesday, October 5, 2011

Re: I need suggestions for compositeCell selection

My bad. The description might have been insufficient.
I have an overwritten multiselection model because I want to select
multiple items. I'm not sure if this makes any difference but I
mentioned it just in case.

My problem is how to tick check box when I click on the imageCell when
the item is already selected.

So once again. I know how to select an item and tick the checkBox by
clicking on the image cell - I use custom eventTranslator and make the
hasCell with a single checkBox depending on selection and not handle
selection on it's own.

Now I replaced the hasCell with single checkBoxCell with hasCell
containing a cell made of 3 custom checkBoxes ( I added a name
attribute describing resolution so that I know which one was selected
when change event is fired).
I added lastChanged property to the underlying object to remember what
fired the event. I set the property in eventTranslator.

I want the item to be selected and backgroud color changed if at least
one of the checkBoxes is ticked=> unticking single checkbox doesn't
necessarily lead to deselecting an item.
I also want it to be selected when the imageCell is clicked. In that
case the default checkBox should be ticked.

Clicking on checkBoxes to select image is simple. I can click on the
imageCell and tick the default resolution this way but only if the
item hasn't been selected yet.
If it's already selected the cell is not rerendered
.

I thought that the problem was in selectionModel.resolveChanges

if (selected) {
if (oldValue == null || !oldValue.equals(object)) {
......

It only fired event if there was no selection or other item had been selected.
I needed it to fire a changeEvent if other checkBox in the same item
was ticked. In other words when property not the object changed.
So I replaced that code with if (oldValue == null ||
object.lastChange()!= null)
So my model is firing the event now but it gets lost somewhere. The
cellList isn't calling renderRowValues => the cell isn't re-rendered=>
box isn't ticked

To sum up hacking things is never good idea and my solution doesn't work.
How should I implement this properly?

regards

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment