javascript - Scroll issue on table row removal -
i have following html code:
<tr id="cv643" ondblclick="oncve(643)"> <td colspan="2"> <a onclick="btncva(41,643)" href="#"> actions <span class="badge badgew">2</span> </a> </td> <td>confirm appointment</td> <td>29-12-2015</td> <td style="color: red">12-01-2016</td> <td style="color: red">pending</td> <td colspan="2"></td> </tr>
client code is:
function btncva(cpkey, cvkey) { var sel, tbl; if (onhidecva()) { // test if action list there $.ajax call create table row id 'reccva' } } function onhidecva() { var sel, rc=1; if ((sel = document.getelementbyid('reccva')) !== null) { sel.parentnode.removechild(sel); rc=0; } return rc; }
when actions button clicked, btncva creates row underneath reccva structure, row contains sub-table button on [thead] call onhidecva, removes reccva tr structure such:
<tr id="reccva"> <td></td> <td colspan="7"> <table id="tblcva" class="table table-condensed"> <thead id="q643"> <tr class="lpinfo"> <th></th> <th>action</th> <th>date</th> <th>user</th> <th>recipient</th> <th>due date</th> <th>status</th> <th>note</th> <th style="text-align:right"> <button id="addcva" class="btn btn-info btn-xs" onclick="btncvaa(643)">add action</button> <button class="btn btn-info btn-xs" onclick="onhidecva()">- </button> </th> </tr> </thead> <tbody> (lots of trs) </table>
so there call onhidecva btncva, , straight call onhidecva on inner button. in instances page larger screen, if click on button calls onhidecva directly, reccva row removed, , page not scroll. want. if click on btncva a-link, onhidecva called indirectly, row removed, page scrolls top. not want. can't figure out. calling onhidecva directly removes row , nothing. calling onhidecva indirectly via btncva removes row scrolls top of page. confusing.
firefox 40.0.3.
any help? thanks. eric.
Comments
Post a Comment