<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: smithveg</title>
    <description>The latest articles on DEV Community by smithveg (@smithvegstack).</description>
    <link>https://dev.to/smithvegstack</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4112307%2F2388c0ca-2c9e-4924-ad46-67ae98e8bd39.png</url>
      <title>DEV Community: smithveg</title>
      <link>https://dev.to/smithvegstack</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/smithvegstack"/>
    <language>en</language>
    <item>
      <title>SmoothDelete: Animated AJAX Row Deletion for Modern and Legacy Web Apps</title>
      <dc:creator>smithveg</dc:creator>
      <pubDate>Sun, 06 Sep 2026 12:48:47 +0000</pubDate>
      <link>https://dev.to/smithvegstack/smoothdelete-animated-ajax-row-deletion-for-modern-and-legacy-web-apps-3mbl</link>
      <guid>https://dev.to/smithvegstack/smoothdelete-animated-ajax-row-deletion-for-modern-and-legacy-web-apps-3mbl</guid>
      <description>&lt;p&gt;Deleting one table row should feel immediate and polished, even in older business systems. Most CRUD scaffolding deletes a row by navigating to a URL and reloading the whole page — which resets your scroll position, filters, and pagination, and makes even a solid backend feel outdated.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;SmoothDelete&lt;/strong&gt;: a small, reusable pattern for deleting a record asynchronously and animating the row out of the interface, with no page reload.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;A dedicated AJAX endpoint handles the delete and returns JSON (&lt;code&gt;{"success": true}&lt;/code&gt; or &lt;code&gt;{"success": false, "message": "..."}&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;On success, the row gets a CSS transition, then — in the next animation frame — fades and scales down slightly (the one-frame delay matters: set both the start and end state in the same tick and the browser won't animate anything)&lt;/li&gt;
&lt;li&gt;After the fade, the row's height collapses (padding + &lt;code&gt;scaleY(0)&lt;/code&gt;) so it doesn't leave a blank gap&lt;/li&gt;
&lt;li&gt;The DOM node is removed, and if the table's now empty, an empty-state message shows&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It's framework-free at its core (&lt;code&gt;assets/smooth-delete.js&lt;/code&gt; + &lt;code&gt;.css&lt;/code&gt;), with a legacy jQuery version for older codebases, and a full working PHP + PDO/SQLite reference backend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Safe mode vs. optimistic mode
&lt;/h2&gt;

&lt;p&gt;One thing I wanted to get right: two documented deletion modes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Safe mode (default):&lt;/strong&gt; the row disappears only after the server confirms the delete succeeded. On failure, the button re-enables and shows an error. UI and database never disagree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimistic mode:&lt;/strong&gt; the row disappears the instant the request settles — even on failure — for cases where instant feedback matters more, with a visible warning if the delete wasn't actually confirmed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hiding a row client-side is never proof the database row is gone — every backend example validates, authorizes, and checks CSRF before deleting anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
bash
cd examples/plain-php
php -S localhost:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>php</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
