1500行的表含表的每一行 - 阿贾克斯还是其他什么东西?什么东西、表含表、阿贾克斯

2023-09-10 17:52:50 作者:睁眼后,世界的迷

我有一个包含1500行的一个非常大的HTML表(由PHP产生的标记)。每一行都有一个5元的复选框和一个文本区域。

I have a very large HTML table containing 1500 rows (markup produced by PHP). Each row has a 5-element checkbox and one textarea.

下面是一个例子行:

<tr id="abc123">
    <td>abc123</td>
    <td valign="top"><input name="v1" value=1 type="checkbox"></td>
    <td valign="top"><input name="v2" value=2 type="checkbox"></td>
    <td valign="top"><input name="v3" value=3 type="checkbox"></td>
    <td valign="top"><input name="v4" value=4 type="checkbox"></td>
    <td valign="top"><input name="v5" value=5 type="checkbox"></td>
    <td valign="top"><textarea name="notes"></textarea></td>
    <td valign="top"><input type="submit" name="submit"></td>
    </tr>

有多个列,但是这是最重要的组成部分。

There are more columns but this is the important part.

什么是设置此功能的最佳途径,使提交按钮被选中/重绘每60秒?如果已经提交行/形式,提交按钮将需要更改为链路。

What would be the best way of setting this up so that the submit button is checked/redrawn every 60 seconds? If the row/form has been submitted, the submit button would need to change to a link.

可否有很多写发生一下子导致可怕的性能?我们的服务器可以处理它,但我更关心的是客户端功能(谁使用中档或更糟的台式机)。

Would having that many writes occurring all at once lead to horrible performance? Our server can handle it, but I'm more concerned about client capabilities (who are using mid-grade or worse desktop machines).

除了打破了记录到单独的页面(客户端在不感兴趣),有没有处理一个页面上这么多形式的更好的办法?

Other than breaking up the records onto separate pages (client not interested in that), is there a better way of handling this many forms on a single page?

更新 我想它可能会更有意义,让用户点击他们想要更新的行,那么这将仅该行转换为表格上。如果某行失去焦点,我会显示一个confim箱,这样他们就不会失去或提交不完整的数据。

Update I'm thinking it might make more sense to let users click on the row they want to update, which would then convert only that row to a form. If a row loses focus, I'll display a confim box so they don't lose or submit incomplete data.

推荐答案

1)把一个表单标签对之间的整个表。

1) Put your entire table between a single form tag pair.

2)确定每个复选框或其他元素的名称标记,它看起来是这样的:

2) Identify each checkbox or other element with a name tag that looks something like this:

checkbox_abc123_1  (value=1)
checkbox_abc123_2  (value=2)
textbox_abc123 (value=foobar)

3)添加一个onClick或onBlur事件到每个输入对象。这将是你的Ajax调用。送的ID标签为名称和输入值作为'值'。您将使用这些后处理。

3) Add an onClick or onBlur event to each input object. This will be your ajax call. Send the id tag as 'name' and the input value as 'value'. You'll use these for POST processing.

4)在您的文章页面上,确定您的输入元素(提示:爆炸('_',$名);),验证的内容,并写信给你的SQL表。

4) On your POST page, identify your input element (hint: explode('_',$name);), validate contents, and write to your SQL table.

您可以使用您的文章页面上提供的更新,在每个表行宣布,以该字段更新其他用户股利。这不会解决更新其他用户输入对象的问题,但是。

You can use your post page to provide an update to a div on each table row announcing to other users that the field is updated. This won't solve the issue of updating the input objects for other users, however.

如果您需要实际的code回复回来,但是这应该指向你在正确的方向。

If you need actual code reply back, but this should point you in the right direction.

 
精彩推荐