1. #1
    Sencha User
    Join Date
    Aug 2013
    Posts
    7
    Vote Rating
    0
    pvuppala is on a distinguished road

      0  

    Default Unanswered: isse with GridRowEditing for all the rows except the first

    Unanswered: isse with GridRowEditing for all the rows except the first


    I'm facing an issue with Gridrowediting. Only the first row of the grid is retaining the edited values on save. The rest of the rows dont show me the new value on save. I have created a MapValueProvider class which would get the grid data instead of PropertyAccess.Below is the snippet of my code.


    for(DataColumn column : columns){

    ColumnConfig<ReportObject, ?> columnConfig = new ColumnConfig<ReportObject, T>(new MapValueProvider(column.getName()), column.getDefaultWidth(), column.getColumnHeading());

    listColumnConfig.add(columnConfig);
    mapColumnConfig.put(column.getName(),columnConfig);

    }

    columnModel = new ColumnModel<ReportObject>(listColumnConfig);

    for(DataColumn columnIter : columns){
    if(columnIter.getDataType().equals(DataType.String)){
    editing.addEditor(mapColumnConfig.get(columnIter.getName()), new TextField());
    }}


    public class MapValueProvider<T> implements ValueProvider<ReportObject, T> {
    private T field;

    public MapValueProvider(T field) {
    this.field = field;
    }

    @Override
    public String getPath() {
    return (String) field;
    }

    @Override
    public T getValue(ReportObject object) {
    return (T)object.getDataMap().get(field);
    }

    @Override
    public void setValue(ReportObject object, T value) {
    }


    My application retrives a resultset from a db table and returns list of ReportObject which contains a map where in the key is the column name and the value is the column value.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Answers
    109
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      2  

    Default


    You have a empty setValue, which means that no values can ever be saved back to the object again.

    I dont know why the first row is working without seeing the rest of the runnable code, but I might guess that something is wrong with your modelkeyprovider, that it isn't actually providing unique keys for each row.

  3. #3
    Sencha User
    Join Date
    Aug 2013
    Posts
    7
    Vote Rating
    0
    pvuppala is on a distinguished road

      0  

    Default


    HI Colin - I am now setting soemthing in the setValue of MapValueProvider. Below is the code.

    @Override
    public void setValue(ReportObject object, T value) {
    object.getDataMap().put((String) field, value);
    }

    ModelKeyProvider code:

    store = new ListStore(new ModelKeyProvider<ReportObject>() {
    @Override
    public String getKey(ReportObjectitem) {
    return String.valueOf(item.getDataMap().get("CodeId"));
    }
    });

    Where codeId is the primary key of the dbtable.

    The new value is now saved but is not displaying in the grid. ie. when I click on any any edited row, I can see the new value( only in row editing mode) but the grid as such shows me the the old value.

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Answers
    109
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Unfortunately, the limit to what I can do with incomplete code has been reached - I can't see the Grid setup to discover if there was a mistake in how you built the grid, nor can I see your sample data to see if you have more than one item with the same CodeID. Can you share a runnable sample that implements EntryPoint that still has this issue?

Thread Participants: 1