Board index » jbuilder » How to make specific column displayed using jdbtable with a dataset.

How to make specific column displayed using jdbtable with a dataset.


2003-10-25 11:08:23 PM
jbuilder18
I mean I already have a dataset here, and I dont want create a new one.
I want to use a subset of columns of this dataset to be displayed at
jdbtable.
(normally all the column in the dataset will be displayed in the jdbtable)
How could I achieve that.
Thanks very much.
David
 
 

Re:How to make specific column displayed using jdbtable with a dataset.

I mean I already have a dataset here, and I dont want create a new one.
I want to use a subset of columns of this dataset to be displayed at
jdbtable.
(normally all the column in the dataset will be displayed in the jdbtable)
How could I achieve that.
Thanks very much.
David
 

Re:How to make specific column displayed using jdbtable with a dataset.

dataSet.getColumn("columnName").setVisible(false) will turn off the column
display in the table.
--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
www.datadevelopment.com/
"David Huang" < XXXX@XXXXX.COM >wrote in message
Quote
I mean I already have a dataset here, and I dont want create a new one.

I want to use a subset of columns of this dataset to be displayed at
jdbtable.

(normally all the column in the dataset will be displayed in the jdbtable)

How could I achieve that.

Thanks very much.
David



 

{smallsort}

Re:How to make specific column displayed using jdbtable with a dataset.

Thank you Kevin.
But I still want other dbswing component using this dataSet display this
column.
Can I limit displayed column only on jdbTable layer.
Thanks
David
"Kevin Dean" < XXXX@XXXXX.COM >写入消息新闻
:3f9bc434$ XXXX@XXXXX.COM ...
Quote
dataSet.getColumn("columnName").setVisible(false) will turn off the column
display in the table.

--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html

BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server

Dolphin Data Development Ltd.
www.datadevelopment.com/

"David Huang" < XXXX@XXXXX.COM >wrote in message
news:3f9b9307$ XXXX@XXXXX.COM ...
>I mean I already have a dataset here, and I dont want create a new one.
>
>I want to use a subset of columns of this dataset to be displayed at
>jdbtable.
>
>(normally all the column in the dataset will be displayed in the
jdbtable)
>
>How could I achieve that.
>
>Thanks very much.
>David
>
>
>


 

Re:How to make specific column displayed using jdbtable with a dataset.

David Huang wrote:
Quote
Thank you Kevin.

But I still want other dbswing component using this dataSet display this
column.

Can I limit displayed column only on jdbTable layer.

You could do this in your class that contains the table by creating a
variable that is qual to the original QueryDataSet using the call
dataSet.getColumn("columnName").setVisible(false) that Kevein gave you. Use
this variable to bind to the table.
Second way is to override the Table Model in the JdbTable and render your
own colums/rows.
 

Re:How to make specific column displayed using jdbtable with a dataset.

Thanks a lot pNichols
The case is a dataSet is shared by more than one view. When one field
changes in one panel should automatically cause other panel's data change
the same time.
If I create a new dataset in my one class and copy the original dataset
here. The change will not affect the original dataSet.
Is there any event before the table displayed , and any event after the
jdbtable hidden? If so I can do something there.
Could you help me on this.
Thanks
David
"pNichols" < XXXX@XXXXX.COM >????
Quote
David Huang wrote:

>Thank you Kevin.
>
>But I still want other dbswing component using this dataSet display this
>column.
>
>Can I limit displayed column only on jdbTable layer.
>
You could do this in your class that contains the table by creating a
variable that is qual to the original QueryDataSet using the call
dataSet.getColumn("columnName").setVisible(false) that Kevein gave you.
Use
this variable to bind to the table.

Second way is to override the Table Model in the JdbTable and render your
own colums/rows.

 

Re:How to make specific column displayed using jdbtable with a dataset.

you can filter again in your dataset.
"David Huang" < XXXX@XXXXX.COM >写入邮件
Quote
I mean I already have a dataset here, and I dont want create a new one.

I want to use a subset of columns of this dataset to be displayed at
jdbtable.

(normally all the column in the dataset will be displayed in the jdbtable)

How could I achieve that.

Thanks very much.
David


 

Re:How to make specific column displayed using jdbtable with a dataset.

Thanks dooluby
Can you explain it more.
Thanks a lot.
David
"dooluby" < XXXX@XXXXX.COM >写入邮件
Quote
you can filter again in your dataset.


"David Huang" < XXXX@XXXXX.COM >写入邮件
news: XXXX@XXXXX.COM ...
>I mean I already have a dataset here, and I dont want create a new one.
>
>I want to use a subset of columns of this dataset to be displayed at
>jdbtable.
>
>(normally all the column in the dataset will be displayed in the
jdbtable)
>
>How could I achieve that.
>
>Thanks very much.
>David
>
>


 

Re:How to make specific column displayed using jdbtable with a dataset.

David Huang wrote:
Quote
Thanks a lot pNichols

The case is a dataSet is shared by more than one view. When one field
changes in one panel should automatically cause other panel's data change
the same time.

If I create a new dataset in my one class and copy the original dataset
here. The change will not affect the original dataSet.

Is there any event before the table displayed , and any event after the
jdbtable hidden? If so I can do something there.

Could you help me on this.

I woudl assign my one DataSet to the other DataSet. When one saves and
commits, then the Database assings the commits, the Dataset just informs it
what data is being committed.
For instance, you have a QueryDataSet in DM_Main DataModule. We will call it
qryAddress for instance.
public class DM_Main implements DataModule {
private QueryDataSet qryAddress;
private Database db;
private static DM_Main dm;
public DM_Main() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
//code here
}
public static DM_Main getDM_Main() {
if(dm==null) {
dm= new DM_Main();
}
return dm;
}
public QueryDataSet getQryAddress() {
return qryAddress();
}
Your new class
public class SomeClass extends JFrame {
private QueryDataSet qryAddress;
private DM_Main dm= DM_Main.getDM_Main();
private JdbTable myTable()= new JdbTable();
publicSomeClass() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
private void jbInit() throws Exception {
//code here as required
//here is an assingment of dm.qryAddress
qryAddress=dm.getQryAddress();
qryAddress.getColumn("columnName").setVisible(false);
qryAddress.getColumn("anotherColumn").setVisible(false);
jdbTable.setDataSet(qryAddress);
//more code as required.
//now a listener that will fire on PostRow
qryAddress.addDataChangeListener(new
com.borland.dx.dataset.DataChangeAdapter() {
public void postRow(DataChangeEvent e) throws Exception {
qryAddress_postRow(e);
}
});
....
}
//this will refresh your changes to both DataSets..
void qryAddress_postRow(DataChangeEvent e) {
dm.getDB().saveChanges(qryAddress);
qryAddress.refresh();
dm.getQryAddress().refresh();
}
}
Now the Data has changed and should be reflected in both your local
QryDataSet and the QueryDataSet you are assigning to the local qryAddress
in class SomeClass. The second refresh may not be necessary, I am not wring
this code in JB, but off the top of my head <G>.
 

Re:How to make specific column displayed using jdbtable with a dataset.

In < XXXX@XXXXX.COM >David Huang wrote:
Quote
I mean I already have a dataset here, and I dont want create a new one.

I want to use a subset of columns of this dataset to be displayed at
jdbtable.

(normally all the column in the dataset will be displayed in the
jdbtable)

How could I achieve that.

As I remember it, you should beable to "setVisible" the rows you
want to show and hide. Do remember that jdbtable is a dbswing component
and therefore this question is more appropriate in the dbswing section..
John..
--
=============================================
TeamB are volunteer helpers. Please DO NOT REPLY VIA EMAIL!
Post all questions and replies to this newsgroup ONLY
For papers on DataExpress, Applets, JSP, and Web Development go to:
www.microps.com/mps/papers.htm
====================================================
 

Re:How to make specific column displayed using jdbtable with a dataset.

Setting a column's visible property to false doesn't affect how it is
displayed by other components, only by the JdbTable.
--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
www.datadevelopment.com/
"David Huang" < XXXX@XXXXX.COM >wrote in message
Quote
Thank you Kevin.

But I still want other dbswing component using this dataSet display this
column.

Can I limit displayed column only on jdbTable layer.

Thanks
David
"Kevin Dean" < XXXX@XXXXX.COM >写入消息新闻
:3f9bc434$ XXXX@XXXXX.COM ...
>dataSet.getColumn("columnName").setVisible(false) will turn off the
column
>display in the table.
>
>--
>Check out our latest white papers at
>www.datadevelopment.com/papers/index.html
>
>BladeNET Scores With Borland Enterprise Tools
>Team Development with JBuilder and Borland Enterprise Server
>
>Dolphin Data Development Ltd.
>www.datadevelopment.com/
>
>"David Huang" < XXXX@XXXXX.COM >wrote in message
>news:3f9b9307$ XXXX@XXXXX.COM ...
>>I mean I already have a dataset here, and I dont want create a new
one.
>>
>>I want to use a subset of columns of this dataset to be displayed at
>>jdbtable.
>>
>>(normally all the column in the dataset will be displayed in the
jdbtable)
>>
>>How could I achieve that.
>>
>>Thanks very much.
>>David
>>
>>
>>
>
>


 

Re:How to make specific column displayed using jdbtable with a dataset.

Thanks pNichols,
I have understood your idea now, you mean to create another dataSet just
like a view for this jDBTable and using Event firing mechanism to
synchronize both dataSet, that's a good idea indeed, I will try to do it
this way.
Thanks again...
David
"pNichols" < XXXX@XXXXX.COM >????
Quote
David Huang wrote:

>Thanks a lot pNichols
>
>The case is a dataSet is shared by more than one view. When one field
>changes in one panel should automatically cause other panel's data
change
>the same time.
>
>If I create a new dataset in my one class and copy the original dataset
>here. The change will not affect the original dataSet.
>
>Is there any event before the table displayed , and any event after the
>jdbtable hidden? If so I can do something there.
>
>Could you help me on this.
>
I woudl assign my one DataSet to the other DataSet. When one saves and
commits, then the Database assings the commits, the Dataset just informs
it
what data is being committed.

For instance, you have a QueryDataSet in DM_Main DataModule. We will call
it
qryAddress for instance.

public class DM_Main implements DataModule {

private QueryDataSet qryAddress;
private Database db;
private static DM_Main dm;

public DM_Main() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}

private void jbInit() throws Exception {
//code here

}

public static DM_Main getDM_Main() {
if(dm==null) {
dm= new DM_Main();
}
return dm;
}

public QueryDataSet getQryAddress() {
return qryAddress();
}


Your new class

public class SomeClass extends JFrame {
private QueryDataSet qryAddress;
private DM_Main dm= DM_Main.getDM_Main();
private JdbTable myTable()= new JdbTable();

publicSomeClass() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}


private void jbInit() throws Exception {
//code here as required
//here is an assingment of dm.qryAddress
qryAddress=dm.getQryAddress();
qryAddress.getColumn("columnName").setVisible(false);
qryAddress.getColumn("anotherColumn").setVisible(false);
jdbTable.setDataSet(qryAddress);
//more code as required.



//now a listener that will fire on PostRow
qryAddress.addDataChangeListener(new
com.borland.dx.dataset.DataChangeAdapter() {
public void postRow(DataChangeEvent e) throws Exception {
qryAddress_postRow(e);
}
});

....
}
//this will refresh your changes to both DataSets..

void qryAddress_postRow(DataChangeEvent e) {
dm.getDB().saveChanges(qryAddress);
qryAddress.refresh();
dm.getQryAddress().refresh();
}

}

Now the Data has changed and should be reflected in both your local
QryDataSet and the QueryDataSet you are assigning to the local qryAddress
in class SomeClass. The second refresh may not be necessary, I am not
wring
this code in JB, but off the top of my head <G>.








 

Re:How to make specific column displayed using jdbtable with a dataset.

Do you know Chinese?
"David Huang" < XXXX@XXXXX.COM >写入邮件
Quote
Thanks dooluby

Can you explain it more.

Thanks a lot.
David


"dooluby" < XXXX@XXXXX.COM >写入邮件
news: XXXX@XXXXX.COM ...
>you can filter again in your dataset.
>
>
>"David Huang" < XXXX@XXXXX.COM >写入邮件
>news: XXXX@XXXXX.COM ...
>>I mean I already have a dataset here, and I dont want create a new
one.
>>
>>I want to use a subset of columns of this dataset to be displayed at
>>jdbtable.
>>
>>(normally all the column in the dataset will be displayed in the
jdbtable)
>>
>>How could I achieve that.
>>
>>Thanks very much.
>>David
>>
>>
>
>


 

Re:How to make specific column displayed using jdbtable with a dataset.

Yeah.. I am Chinese.
"dooluby" < XXXX@XXXXX.COM >写入邮件
Quote
Do you know Chinese?


"David Huang" < XXXX@XXXXX.COM >写入邮件
news: XXXX@XXXXX.COM ...
>Thanks dooluby
>
>Can you explain it more.
>
>Thanks a lot.
>David
>
>
>"dooluby" < XXXX@XXXXX.COM >写入邮件
>news: XXXX@XXXXX.COM ...
>>you can filter again in your dataset.
>>
>>
>>"David Huang" < XXXX@XXXXX.COM >写入邮件
>>news: XXXX@XXXXX.COM ...
>>>I mean I already have a dataset here, and I dont want create a new
one.
>>>
>>>I want to use a subset of columns of this dataset to be displayed at
>>>jdbtable.
>>>
>>>(normally all the column in the dataset will be displayed in the
>jdbtable)
>>>
>>>How could I achieve that.
>>>
>>>Thanks very much.
>>>David
>>>
>>>
>>
>>
>
>