Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Selection problem with new added records

    Hi,

    I'm getting this problem with GWT 3.1 and 3.1p.

    I'm using a list grid with the following config:

    Code:
    private ListGrid infoGrid = new ListGrid();
    infoGrid.setDataSource(RIMDataSources.RIM_DATE_SPEFIC_INFO);
    infoGrid.setAutoFitData(Autofit.BOTH);
    infoGrid.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
    infoGrid.setAutoSaveEdits(false);
    infoGrid.setNeverValidate(true);
    infoGrid.setConfirmCancelEditing(false);
    infoGrid.setConfirmDiscardEdits(false);
    infoGrid.setEditEvent(ListGridEditEvent.NONE);
    infoGrid.setWidth100();
    infoGrid.setHeight("75%");
    infoGrid.setAutoFetchData(false);
    infoGrid.setAutoSizeHeaderSpans(true);
    In case an already existing record should be updated, I'm doing the following:

    Code:
    int index = infoGrid.getRecordIndex(infoGrid.getSelectedRecord());
    infoGrid.startEditing();
    for (String attr : record.getAttributes()) {
    infoGrid.setEditValue(index, attr,record.getAttribute(attr));
    }
    infoGrid.endEditing();
    This works fine. Existing records are updated at the grid (not the database!), edited values are marked with blue text color and the record is still selectable for further changes.


    The problem starts, if I added a new record to the grid:
    Code:
    infoGrid.startEditingNew(record);
    infoGrid.endEditing();
    The new record is added to the grid (not the database!), marked with blue text, but is not selectable. I need the new added record to be selectable, so that I'm able to do further changes.


    If the user finally wants to save the list grid changes (remove/add/update records) to the database, I'm calling:

    Code:
    infoGrid.deselectAllRecords();
    infoGrid.saveAllEdits();
    After that, the new records are added to the database and I can finally select those records at the grid (they are no longer marked with blue text).


    But I need to be able to select new added records at the grid, before I finally save them to the database. Any suggestion what I'm doing wrong or how I can fix that problem?

    #2
    New, unsaved records can be re-edited by the user but do not support selection as such.

    See the "Handling Unsaved Records" overview linked from the Grid Editing overview for an explanation and various strategies if you really need selection.

    Comment

    Working...
    X