Announcement

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

    removeSelectedData in a grouped grid without data-source

    Hello Isormorphic,

    I have encountered something which looks like a bug.
    I have a grouped grid which is not bound to a data source.

    When I'm using removeSelectedData on that grid, the record does not seem to be 'properly' removed.
    visually, the record is removed, but I'm noticing two issues (probably just two symptoms of a deeper problem?):
    1. The group which contains only that record, is not removed as well.
    2. calling getOriginalData().length still returns the number of records as before the removal.

    These 2 problems don't happen when the grid is data-bound and also when it is not grouped.

    I've also noticed that if instead of calling removeSelectedData, I call getSelectedRecord followed by removeData, then everything works as expected.

    I'm seeing this with the latest SC version (v12.1p_2021-01-23).

    The following code snippet demonstrates the problem (the 'RemoveData" button works as expected, but the "RemoveSelectedData" button shows the problem):

    Code:
    <ListGrid
        top="20"
        ID="listGrid" 
        width="100%" 
        height="200"
        groupByField="itemName"
    >
      <fields>
        <field name="itemName"    type="text"     />
        <field name="SKU"         type="text"     />
      </fields> 
    </ListGrid>
    
    <JS>listGrid.setData([
      {itemName: "AAA", SKU: "111"},
      {itemName: "BBB", SKU: "222"},
      {itemName: "CCC", SKU: "333"},
      {itemName: "DDD", SKU: "444"}
    ]);
    </JS>
    
    <Button top="220" title="RemoveData" 
      click="var r = listGrid.getSelectedRecord(); listGrid.removeData(r, () => { alert(listGrid.getOriginalData().length); })"/>
    
    <Button top="260" title="RemoveSelectedData" 
      click="listGrid.removeSelectedData(() => { alert(listGrid.getOriginalData().length); });"/>
    Thanks
    Gil

    #2
    This has been resolved in SC 11.1 and newer releases. The fix will be in the nightly builds dated 2021-01-28 and beyond.

    Comment

    Working...
    X