Note that there are some explanatory texts on larger screens.

plurals
  1. POShow Hide Dynamically Added Table Row
    primarykey
    data
    text
    <p>I have implement search on table and it works fine. But there is one problem after I update the table row. Search always show the edited row even if it does not match the search.</p> <p>eg. steps - 1.enter "user3" in search box then result - user3 2.edit "user3" 3.enter "user1" in search box then result - user1,user3</p> <p><strong>HTML</strong></p> <pre><code>&lt;table&gt; &lt;tbody id="list"&gt; &lt;tr id="o1"&gt; &lt;td class="txtclass"&gt;user&lt;/td&gt; &lt;td&gt;&lt;a&gt;edit&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="o2"&gt; &lt;td class="txtclass"&gt;user2&lt;/td&gt; &lt;td&gt;&lt;a&gt;edit&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="o3"&gt; &lt;td class="txtclass"&gt;user3&lt;/td&gt; &lt;td&gt;&lt;a&gt;edit&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="o4"&gt; &lt;td class="txtclass"&gt;user4&lt;/td&gt; &lt;td&gt;&lt;a&gt;edit&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p><strong>script</strong></p> <pre><code>// function to replace table row // d- table row html function updateRow(d) { $("#o3").before(d).remove(); } </code></pre> <p>// search in table row list</p> <pre><code>$("#textsearch").change(function () { var filter = $(this).val().toLowerCase(); var li; list = list of table rows; len = list.length; for (var i = 0; i &lt; len; i++) { li = list[i]; txt = $(li).find(".txtclass").text(); if ((txt || "").toLowerCase().indexOf(filter) &gt;= 0) { if (li.style.display == "none") { li.style.display = "block"; } } else { if (li.style.display != "none") { li.style.display = "none"; } } } return false; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload