Ok from the other threads I managed to use RPC and DadaSource using setTestData(). Thank you.
Now I don't know why when I edit something in the ListGrid, on ENTER the edited cells returns to it's previous value.
my DataSource is:
and my ListGrid is:
I was trying to follow the example http://www.smartclient.com/smartgwt/...id_editing_row but using RPC instead, there when I hit enter the values remain changed. Not in my above sample, it could be that I'm missing something stupid really...
Now I don't know why when I edit something in the ListGrid, on ENTER the edited cells returns to it's previous value.
my DataSource is:
Code:
public class TabelaColunasDS extends DataSource { public TabelaColunasDS(ArrayList<BaseBean> asColunas) { setClientOnly(true); DataSourceTextField tf_chvP = new DataSourceTextField("chvP"); DataSourceTextField tf_nome = new DataSourceTextField("nome"); DataSourceTextField tf_tipo = new DataSourceTextField("tipo"); DataSourceTextField tf_isObrigatorio = new DataSourceTextField("isObrigatorio"); DataSourceTextField tf_isPk = new DataSourceTextField("isPk"); setFields(tf_chvP, tf_nome, tf_tipo, tf_isObrigatorio, tf_isPk); loadData(asColunas); } private void loadData(ArrayList<BaseBean> asColunas) { ListGridRecord[] camposTabela = new ListGridRecord[asColunas.size()]; for (int i = 0; i < asColunas.size(); i++) { BaseBean baseBean = asColunas.get(i); if (baseBean instanceof TableField) { TableField tf = (TableField) baseBean; camposTabela[i] = new ListGridRecord(); camposTabela[i].setAttribute("chvP", tf.getChvP()); camposTabela[i].setAttribute("nome", tf.getNome()); camposTabela[i].setAttribute("tipo", tf.getTipo()); camposTabela[i].setAttribute("isObrigatorio", tf.isObrigatorio()); camposTabela[i].setAttribute("isPk", tf.getPK()); camposTabela[i].setAttribute("baseBean", tf); } } setTestData(camposTabela); } }
Code:
private void initColunas(ArrayList<BaseBean> asColunas) { TabelaColunasDS tabelaColunasDS = new TabelaColunasDS(asColunas); ListGrid listGrid = new ListGrid(); listGrid.setAutoFetchData(true); listGrid.setCanEdit(true); listGrid.setDataSource(tabelaColunasDS); ListGridField lgfChvP = new ListGridField("chvP", "ChaveP"); ListGridField lgfNome = new ListGridField("nome", "Nome"); ListGridField lgfTipo = new ListGridField("tipo", "Tipo"); ListGridField lgfIsPk = new ListGridField("isPk", "isPk"); listGrid.setFields(lgfChvP, lgfNome, lgfTipo, lgfIsPk); addItem(listGrid); }
Comment