Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'cell-update' event seems to return wrong details #36

Open
calin-dobos opened this issue Mar 5, 2024 · 0 comments
Open

'cell-update' event seems to return wrong details #36

calin-dobos opened this issue Mar 5, 2024 · 0 comments

Comments

@calin-dobos
Copy link

Hi @OvidijusParsiunas ,

When using the the 'cell-update' event listener:

  • when the component is loaded, first n-1 rows have updateType: "Update", while the last one has updateType: "Add"
  • when deleting any row, the rowIndex for updateType: "Removed" is always the last one.

While visually the last row of the table is always the one to be actually removed, the rowIndex should point to the original row in the data source, so in case we use "Sort Ascending"/"Sort Descending" we can still track the logical row that was deleted.

<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/active-table@1.1.5/dist/activeTable.bundle.js" type="module"></script>
</head>
<body>
<active-table id="at"
  data='[
    ["Planet", "Diameter", "Mass", "Moons", "Density"],
    ["Earth", 12756, 5.97, 1, 5514],
    ["Mars", 6792, 0.642, 2, 3934],
    ["Jupiter", 142984, 1898, 79, 1326]]'
></active-table>
<script>
var tableElementRef = document.getElementById("at");
tableElementRef.addEventListener('cell-update', (cellUpdate) => {
  console.log(cellUpdate.detail);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant