Monday, June 3, 2013

Re: Get Data CellTable

Now I understand why you talk about refresh() or updateRowData(...). The first method doesn't do anything for me and my provider dosen't know the second method updateRowData. I don't find a solution on google.

This is a part of my code:

public ArrayList<List<String>> rows = new ArrayList<List<String>>();
ListDataProvider<List<String>> provider;
//...

public widget 
// fill the rows
//add the IndexedColumn

table.setRowCount(rows.size(), true);
table.setRowData(0, rows);

provider = new ListDataProvider<List<String>>(rows);
provider.addDataDisplay(table);

//...
// Save handler
if (item.getText() == "Save") {
int i=0;
provider.refresh();
while(i<table.getRowCount()){
System.out.println(provider.getList().get(i)); // I can't see the changes of the final user here!
i=i+1;
}
}


IndexedColumn:
// Method to add column dynamically to the table
class IndexedColumn extends Column<List<String>, String> {
private final int index;

public IndexedColumn(int index) {
super(new EditTextCell());
this.index = index;
}

@Override
public String getValue(List<String> object) {
return object.get(this.index);
}
}

Can somebody help me please?

Thanks :)

Le vendredi 31 mai 2013 18:15:13 UTC-4, sebastie...@isen-lille.fr a écrit :
Thanks for your answer!

In fact, I don't want to refresh my table. I just want to get all the data which are in my table. My table is editable by the final user. 

Le vendredi 31 mai 2013 17:59:38 UTC-4, David a écrit :

The cells are reused so there's no way to get a specific rendered cell from the CellTable. Update the object in your data provider and call refresh() or updateRowData(...).

On Friday, May 31, 2013 3:44:08 PM UTC-5, sebastie...@isen-lille.fr wrote:
Maybe there is an other way to do that? I don't find a solution...

Le jeudi 30 mai 2013 14:14:33 UTC-4, sebastie...@isen-lille.fr a écrit :
I don't find a method to simply get the text in a cell. It's very weird!

Le mercredi 29 mai 2013 14:46:48 UTC-4, sebastie...@isen-lille.fr a écrit :
Hi everyone,
I have a simple CellTable with editable cells. I add a button "save" outside of the table. So, I want to be able to save the change of the final user.

I want to do something like that:
If the button is cliked:
int i=0;
int j=0;
while(i<table.getRowCount()){
while(j<table.getColumnCount(){
myList = table.getCellText(i,j) ??? ( I don't know how to do that )
j=j+1;
}
i=i+1;
j=0;
}

I don't know how to get a cell individually...

Can you help me?

Thanks.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment