pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhulipalla anu <dhulipalla...@gmail.com>
Subject facing problem in getting records from database and adding them in tableview.
Date Sat, 05 Nov 2011 12:16:20 GMT
I have created a TableView and want that Table to be filled with records
when it was displayed.
So i created sample demo like this.

String query = "select * from personal order by number";
PreparedStatement ps = con.prepareStatement(query);
ResultSet rs = ps.executeQuery();

List<Accounts> list = (List<Accounts>) tableView.getTableData();//Accounts
is the Bean class.
        int count = 0;
while (rs.next()) {
name = rs.getString(1);
number = rs.getString(2);
age = rs.getString(3);
status = rs.getString(4);
 accounts = new Accounts(name, number, age, status);

list.insert(accounts, count);
Up to here it was fine and when run my application it is picking up all the
records from DB and displaying it in TableView.

Now after this i want get a row to be added at top in TableView when a
button was clicked.
For this i have written like,

create.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
List<Accounts> list = (List<Accounts>) tableView.getTableData();
accounts = new Accounts();
if (list.get(0).getName() != null) {

list.insert(accounts, 0);
tableView.getRowEditor().beginEdit(tableView, 0, 0);
} else
tableView.getRowEditor().beginEdit(tableView, 0, 0);
Here when i press create button a row was adding at the top. After that i
tried to edit it and enter some data. I was able to edit in the newly
created row but after that when i press enter, the entered text was not
visible. It was only visible when i make a double click  on that row again.
And also when tried to get that information it was showing null value. Here
it is necessary for me to get that row information and save it.
So please help me how should i reach my requirement..........
I am adding my bxml file content part that shows TableView.

<TableView bxml:id="tableView">
<TableView.Column name="name" headerData="NAME" width="100" />
<TableView.Column name="number" headerData="NUMBER" width="100" />
<TableView.Column name="age" headerData="AGE" width="100" />
<TableView.Column name="status" headerData="STATUS" width="100" />
<rowEditor enable="false">
<content:TableViewRowEditor editEffect="vertical_slide" />
<TextInput />
<TextInput />
<TextInput />
<TextInput />

<TableViewHeader tableView="$tableView" />

Thanks and Regards,

Anusha Dhulipalla


View raw message