1. #1
    Ext User
    Join Date
    May 2007
    Posts
    5
    Vote Rating
    1
    dpu1356 is on a distinguished road

      1  

    Default Store.remove() when filtered

    Store.remove() when filtered


    In my application I have two grids - one for the summary data and one for the detail. The store for the detail grid gets filtered (detailStore.filter()) based on which row is selected in the summary grid. Both of the grids are editable, including removing rows. I have discovered that when a filter is applied to the detail grid, and then the selected detail row is removed from the detail grid (detailStore.remove()), and then another filter is applied and then the original filter is applied again (the one from which the detail record was removed), the detail record re-appears. A workaround is to put the remove() in between clearing and re-applying of the filter, like this:

    Code:
    detailStore.clearFilter();
    detailStore.remove(record);
    detailStore.filter("USER_NAME", record.get("USER_NAME"));
    I took a quick look at the source for Store and I suspect that the issue has something to do with this.data and this.snapshot. I'm guessing that the record is removed from the filtered data, but it doesn't get removed from the total data.

  2. #2
    Ext User
    Join Date
    Mar 2007
    Posts
    10
    Vote Rating
    0
    zeppelin is on a distinguished road

      0  

    Default


    I have the same problem, is it a confirmed bug?

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    I don't know that this is really a bug. Removing a record acts upon the currently active data. This is the entire dataset or a subset if a filter is applied. Filtering data is a non-destructive operation, so removing a row from filtered data should not affect the base dataset. I would think if you really want a destructive remove while the data is filtered, you could override the remove fn to take an additional bool arg that specifies removing from the both datasets when a filter is active.

  4. #4
    Ext User
    Join Date
    Mar 2007
    Posts
    10
    Vote Rating
    0
    zeppelin is on a distinguished road

      0  

    Default


    Ok, dpu1356's trick works good. But I think it is not a 'natural' behaviour, it is not obvious that if you want to delete a record, you have to remind clearing&applying filters...

Thread Participants: 2