Skip to content Skip to sidebar Skip to footer

Slickgrid Cannot Delete Added Rows, But Only Existing Ones. What Am I Doing Wrong?

Here is my code for adding a row: grid.onAddNewRow.subscribe(function (e, args) { var item = args.item; id=id+1; item['id'] = 'id_'+id; grid.invalidateRow(data.leng

Solution 1:

You seem to be doing a lot of things in your code that don't quite make sense to me:

In your onAddNewRow handler, you are:

  1. Invalidating the row being added. Why? You don't need to do that.
  2. You update the "data" array directly but then do a no-op call on the "dataView". What are you using as a data source - data or dataView?
  3. You don't need to tell the grid to updateRowCount() or render().

In your delete handler:

  1. DO NOT access SlickGrid DOM directly (i.e. $(".slick-cell.selected"))! Use grid.getSelectedRows() instead.
  2. If you are using "dataView" as your data source, you should already have events wired up to listen to DataView changes and update the grid as needed. Calls to grid.invalidate() and grid.render() are not needed.

Post a Comment for "Slickgrid Cannot Delete Added Rows, But Only Existing Ones. What Am I Doing Wrong?"