Skip to main content

a question whit jxtable,please help me

10 replies [Last post]
zzsnake
Offline
Joined: 2006-03-20
Points: 0

I have two table in database,"def" and "defg",
"def" table has some records
deficode
1001
1002
1003

---------
and "defg" table has some records

deficode idx name
1001 1 'a1'
1001 2 'b1'
1002 1 'a1'
1002 2 'a2'
1003 1 'a3'

The records is showing in the jxtabledef and jxtabledefg.
I want when the record is pointed at '1001' in jxtabledef
then jxtabledefg is only show
1001 1 'a1'
1001 2 'b1'

when the record is pointed at '1002' in jxtabledef
then jxtabledefg is only show
1002 1 'a1'
1002 2 'a2'

how can I do it? thank.
could you get me some examples,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
zzsnake
Offline
Joined: 2006-03-20
Points: 0

where can i look for any example about JXTable and DataRelation ?

david_hall
Offline
Joined: 2003-06-12
Points: 0

'query a DataRelation for the associated rows'

DataRelation has a method that you call, passing either a DataRow or an index that returns the rows of from the detail table related to the indicated row from the master table.

As to examples, I personally don't know of any that show how to bind JXTable to DataRelation.

zzsnake
Offline
Joined: 2006-03-20
Points: 0

thank you david_hall
i am waiting you so long
I felt only you can help me in the world

mehboob_mak
Offline
Joined: 2007-03-20
Points: 0

> I have two table in database,"def" and "defg",
> "def" table has some records
> deficode
> 1001
> 1002
> 1003
>
>
> ---------
> and "defg" table has some records
>
> deficode idx name
> 1001 1 'a1'
> 1001 2 'b1'
> 1002 1 'a1'
> 1002 2 'a2'
> 1003 1 'a3'
>
> The records is showing in the jxtabledef and
> jxtabledefg.
> I want when the record is pointed at '1001' in
> jxtabledef
> then jxtabledefg is only show
> 1001 1 'a1'
> 1001 2 'b1'
>
> when the record is pointed at '1002' in jxtabledef
> then jxtabledefg is only show
> 1002 1 'a1'
> 1002 2 'a2'
>
> how can I do it? thank.
> could you get me some examples,

[b][/b]

david_hall
Offline
Joined: 2003-06-12
Points: 0

I think perhaps there's been a hiccup in the mail-forum gateway -- I think Patrick responded in this thread, but I didn't see the text of his message.

Patrick Wright

No, I responded to you personally, as it was meant as a private joke
:) Other than that, I wasn't on this thread.

On 3/21/07, jdnc-interest@javadesktop.org wrote:
> I think perhaps there's been a hiccup in the mail<=>forum gateway -- I think Patrick responded in this thread, but I didn't see the text of his message.
> [Message sent by forum member 'david_hall' (david_hall)]
>
> http://forums.java.net/jive/thread.jspa?messageID=209175
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
> For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

kschaefe
Offline
Joined: 2006-06-08
Points: 0

You could add a ListSelectListener to jxtabledef, so that when a row is selected it updates a Filter (probably a PatternFilter) on the jxtabledefg.

zzsnake
Offline
Joined: 2006-03-20
Points: 0

thank you kschaefe.
and I found the class DataRelation.when it can be used?and it can be help for me for here?

david_hall
Offline
Joined: 2003-06-12
Points: 0

DataRelation should be a good way to get the defg records appropriate for a particular def table row. What you might do is get the row (or its index) via the ListSelectionListener as was suggested, then query a DataRelation for the associated rows.

There should be a painless binding mechanism, but that's somewhat pending right now -- the cheap and dirty way would be to write a TableModel that you can pass a list of defg rows to as part of the selection listener.

You might also consider wrapping a TableModel directly around DataRelation/DataRow.

zzsnake
Offline
Joined: 2006-03-20
Points: 0

I try to find some examples about DataRelation .but there is not use to me.
thak you all
and how can i do "then query a DataRelation for the associated rows"