[CLOSED] Delete new record in GridPanel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Delete new record in GridPanel

    Hi
    I have problem deleting newly added rows in a GridPanel. It works great to add row and the delete works if I manually click the row then delete it.
    But it does not work by clicking the "Delete" button directly after adding the row.
    The problem is that for some reason the
    var selection = App.gpPriser.getSelectionModel().getSelection()[0];
    returns undefined. Any ideas of why this happens?

    Add new row
    var row = store.indexOf(store.insert(0, {})[0]); 
    Ext.defer(function () {
         grid.editingPlugin.startEditByPosition({ row: row, column: 0 });
    }, 100);
    Delete button
    var selection = App.gpPriser.getSelectionModel().getSelection()[0];
    if (selection) {
         App.gpPriser.store.remove(selection);
         App.btnSparaPrisrad.fireEvent(App.btnSparaPrisrad.clickEvent); //sparar store, dvs raderar de rader som ska raderas mot databas
    }
    Best regards
    Mikael
    Last edited by fabricio.murta; Nov 20, 2020 at 10:07 PM.

Similar Threads

  1. Delete record on long press
    By RaphaelSaldanha in forum Examples and Extras
    Replies: 1
    Last Post: Apr 23, 2016, 12:57 PM
  2. Replies: 3
    Last Post: Mar 06, 2013, 3:48 AM
  3. how to delete or remove record?
    By richard in forum 2.x Help
    Replies: 0
    Last Post: Jun 08, 2012, 9:12 AM
  4. Delete or remove record from gridpanel
    By lapix in forum 1.x Help
    Replies: 3
    Last Post: Feb 25, 2012, 5:56 PM
  5. Gridpanel delete a record with rowcommand
    By umitcel in forum 1.x Help
    Replies: 3
    Last Post: Jul 23, 2010, 9:27 AM

Posting Permissions