Announcement

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

    How To: Bulk edit new unsaved records in ListGrid

    We've managed to build bulk edit options for many of our ListGrids by using selectionAppearance("checkbox") along with code such as:

    Code:
    var newPrice = userInputPrice;
    
    for each record in grid.getSelectedRecords() {
       isc.addProperties( record, { price: newPrice } );
       grid.updateData( record );
    }
    We now have a grid where users are doing something akin to the mass update example. They are adding several new records, removing some, and then optionally changing the price on several records and this change price function needs to work like a bulk edit.

    However, newEditRows are not selectable and don't return as a part of getAllSelectedRecords.

    We are able to getAllEditRows, but we are unable to determine which editRows are 'selected'.

    Is there some way for a user to "select" new unsaved rows in a grid?

    #2
    First, your code snippet has a flaw - the addProperties() call will immediately modify the record in the cache, which you shouldn't really do if it's possible for the save to fail. You can fix this like so:

    Code:
       var recordToSave = isc.addProperties({}, record, { price: newPrice } );
       grid.updateData( recordToSave );
    As far as new rows not being selectable, see the Handling Unsaved Records overview for background and approaches.

    Comment

    Working...
    X