Login Register

Editable grid with multiple data sources?

I need some advice on strategy. I've got 2 problems displaying
a grid based on a complicated data structure. The data comes
from two data sources, and the editing options need to be different
for different cells.

The easier of the two, is I want a given column editable
using a select box, but I want the list of options to
depend on some underlying data. In some cases, the options
might be "A or B", but in others, "B or C". The 'options'
parameter in the cell definition is a hardcoded list, not
a callback. I'm guessing I can hack my own custom
editor? Is there a better way?

The harder question is, the grid is displaying data from
two different dojo.data sources. I had been been using a custom
'formatter' routine to lookup data in the second source and
then display it. But now that I want to edit the data,
I realize that won't work.

If it helps to explain, dataA contains a list of groups.
A person can be a member of a group, and dataB contains
the list of groups each person is a member of (and the kind
of membership.)

The grid display a row for each group (from dataA).
The person has already been chosen in a previous step,
so the second column in the grid shows (from dataB)
if the chosen person is a member of the group (and
if that membership is direct or indirect.) I want to
edit that membership -- to put the person into or out of
a group.

I hope that's clear enough. The grid might look like:

group1   direct
group2   indirect
group3   none
group4   indirect

where the first column comes from dataA and the second from dataB.
I want to edit the second column, and the edited data has to go
back to some custom routine so I can change the server. As well,
when the second column is edited, the exact list of options will
depend on further data in dataB.

So, what are good options?
- Can I do all this with a custom editor? I'm not sure how to stop
the edited data from going back to dataA (where it would make no sense),
and to retrieve it otherwise.
- Do I need to make a custom model or custom data store? The model or store
could read the real data and combine them. I don't suppose there are any
docs on what parts of the existing available models I'd need to override for this?
- Should I just override the onDoubleClick event for the grid? I'm not fully
sure how I'd get my editor hooked in, in this case.
- Or ?