I looked into the underlying code briefly, and I would suggest that the selection mechanism is one-way bound, eg. when a selection event occurs the value of what's selected is chosen from the data and stored. That stored value is returned on getSelection(). I may be incorrect, but that's my guess.

A solution would be to store the current selection index and make the request, and manually call select() on that index, refreshing the mechanism. something like

//canvas.mygrid is bound to dataset X
var grid = canvas.mygrid;

// get the item at the current selection
var item = grid.getSelection();

//use the item to get it's index
var index = grid.getIndexForItem(item);

//update the dataset - updating the grid
X.doRequest();

//and re-select the index you were on before, refreshing the getSelection() mechanism.
grid.selectItemAt(index);

HTH and i read your problem right. Certainly open to hearing another approach on the matter.

best,
        James.

On Jun 29, 2007, at 4:02 PM, acec acec wrote:

Hi,all

In more detail,
Dataset A from database table account and contact. It
returns account information and all contacts belong to
this account.
For instance, it seems like:
<account>
<accountName>Test</accountName>
<set>
<contact contactid="1" nickname="dad1" telephone="911"
/>
<contact contactid="2" nickname="dad2" telephone="811"
/>
</set>
</account>

Dataset B from database contact. It returns all
contact.
<contacts>
<contact contactid="1" nickname="dad1" telephone="911"
/>
<contact contactid="2" nickname="dad2" telephone="811"
/>
<contact contactid="3" nickname="dad3" telephone="711"
/>
<contacts>

One grid uses Dataset A and another view uses Dataset
B.

I changed nickname of contactid="1" from view and
saved this change into database.

Then I try to update dataset A(get new data from
database), so I call A.doRequest().

On screen, the data of grid is changed. But when I
call grid.getSelection(), it return the old value.

If I reselect that item on grid using mouse,
grid.getSelection() could return me the new value.

I do not know how to solve this problem.

Thanks.
Arden


--- jamesr <[EMAIL PROTECTED]> wrote:

Are you implicitly stating that "updating the common
data" means that
you submitted the dataset back to the server and
stored those values
so that a doRequest() call would get the new
information?

It seems like you have the concept of how datasets
work slightly
wrong, or -- more likely -- it would be good to send
a fuller example
of this two-dataset binding you are doing. If you
can send something
more along, i'm sure we (as a group) could offer
some help.

thx - j.




On Jun 29, 2007, at 3:22 PM, acec acec wrote:

Hi, all
I have the following problem:

I defined two dataset(A / B) and   A / B have some
common data from the same database table.

In one grid, I used datapath to bind dataset A.

In another view, which bind dataset B, after I
updated
the common data, I try to use A.doRequest() to
update
the grid.

But grid.getSelection() always returns the old
data.

Thanks.
Arden

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com





Get news delivered with the All new Yahoo! Mail. Enjoy RSS feeds right on your Mail page. Start today at http:// mrd.mail.yahoo.com/try_beta?.intl=ca

Reply via email to