删除后在javascript中对附加的表行重新编号

时间:2015-05-16 21:41:07

标签: javascript jquery

SoapSerializationEnvelope

嗨我有这些代码来删除一个表行,我的问题是,当我删除一个数字之间的行时,例如我有4行而我删除第2行,行的编号就像1,3,4 ..但我需要它1,2,3我将如何实现这一目标?谢谢你的帮助

这里是我如何动态添加表格

public void register(SoapSerializationEnvelope envelope) {
    envelope.addMapping(NAMESPACE, "BookItem", this.getClass());
}

1 个答案:

答案 0 :(得分:2)

首先删除行,然后使用 $。每个函数

更新其他tr

看看小提琴得到你的结果:https://jsfiddle.net/hL625r4p/

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table border='1'>
    <tr>
        <td class='row-id'>1</td>
        <td>Row 1</td>
        <td><button>Delete</button></td>
    </tr>
    <tr>
        <td class='row-id'>2</td>
        <td>Row 2</td>
        <td><button>Delete</button></td>
    </tr>
    <tr>
        <td class='row-id'>3</td>
        <td>Row 3</td>
        <td><button>Delete</button></td>
    </tr>
    <tr>
        <td class='row-id'>4</td>
        <td>Row 4</td>
        <td><button>Delete</button></td>
    </tr>
</table>
#include "iostream"
#include "Windows.h"
#include "stdio.h"
using namespace std;



int main() {

    HWND hWnd = FindWindow(NULL,TEXT("Vovoid VSXu Artiste 0.4.0 [Windows 64-bit]"));
    if (hWnd == 0) {
        cerr << "Cannot find window "<< endl;
    }
    else {
        DWORD pId;
        GetWindowThreadProcessId(hWnd, &pId);
        cout << "Found Window at "<<pId << endl;
        HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
        HMODULE hModule = GetModuleHandle(TEXT("sound.rtaudio.dll"));

        if (hProc == 0) {
            cerr << "Cannot open process." << endl;
        }else if(hModule==0){
            DWORD error = GetLastError();
            cerr << "could not find Module -> error: " <<error<< endl;
        }
        else {
            float val = 0;
            int addr = 0x04D40000 + 0x19098;//should be sound.rtaudio.dll+ 0x19098
            while(TRUE){
                int suc = ReadProcessMemory(hProc, (LPVOID)addr, &val, (DWORD)sizeof(val), NULL);
                if (suc > 0) {
                    cout << "Success reading " << val << " of " << hex << addr << endl;
                    system("cls");
                }
                else {
                    DWORD error = GetLastError();
                    cerr << "fail " << error << endl;
                }
            }


        }
        CloseHandle(hProc);
    }
    cin.get();
    return 0;
}