Skip to main content

Bug Tracker

Side navigation

#3740 closed bug (invalid)

Opened December 23, 2008 03:15AM UTC

Closed June 12, 2010 03:39AM UTC

Clone the object Error

Reported by: zhuisha Owned by:
Priority: major Milestone: 1.3
Component: unfiled Version: 1.2.6
Keywords: Cc: zhuisha
Blocked by: Blocking:
Description

(Sorry to my poor English,So I'll give you chinese edition go with English edition.)

我使用JQuery来构造一个基于简单模板的动态表格,模板的风格是这样的:

I use Jquery as my libraty to build a simple dynamic table with template,the template is below:

<table id="tblDataTable" width="100%" border="0" cellspacing="0" cellpadding="2">

<colgroup>

<col width="40" />

<col width="40" />

<col width="60" />

<col width="*" />

<col width="120" />

<col width="135" />

</colgroup>

<thead>

<tr>

<td class="ListTitle">

<input type="checkbox" id="checkbox1" name="checkbox1" title="全选" value="全选" />

</td>

<td class="ListTitle">

缓急

</td>

<td class="ListTitle">

发件人

</td>

<td class="ListTitle">

主题

</td>

<td class="ListTitle">

文号

</td>

<td class="ListTitle">

发件时间

</td>

</tr>

</thead>

<tbody>

<tr valign="bottom">

<td>

<input type="checkbox" />

</td>

<td>

sHJ

</td>

<td>

sSender

</td>

<td>

sBH

</td>

<td>

sFWZH

</td>

<td>

sDateTimeReceived

</td>

</tr>

</tbody>

</table>

这个table的tbody里面只有一行,这行作为我的内容模板,

在我动态生成表格的时候.先把行模板作为jQuery对象通过Data()缓存下来,然后删除掉行模版,在生成行的时候通过clone方法把缓存的数据复制下来.然后替换掉模板中的数据.BUG是,我第一次取出的行模板的children("td:gt(0)")返回的jQuery中只有一个td,事实情况是我有6个td,随后再取出的行模板就可以正常操作了.我只好在需要行模板的时候先取出一次丢弃.随后取出的再使用.

(There's only one row in tbody of this table, It's just my simple template and when I generate rows for this Grid,I cache the simple template row (as a jQuery object) use Data method of jQuery, then delete this template row.The data is coming so I get my template (as a jQuery object) with the clone method in jQuery.

My template have 6 TD but with the method I can get only 0 with template.children("td") when I clone the cache template first time (and only the first time). I had to get the template's clone once and throw it and use the next clone.I use visual studio 2008 and jQuery 1.2.6 edition,I debug it step and step and once by once but the error is still.

My email address is xiaoqianglinsen@163.com. Thanks for your dilicious jQuery.

Merry Chiristmas Day

A Honest Programmer Lee

Attachments (4)
Change History (2)

Changed January 03, 2009 12:59AM UTC by flesler comment:1

cc: → zhuisha
owner: flesler

Changed June 12, 2010 03:39AM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed

Sorry but I cannot understand the issue given the partial code and description. Asking for help on a Chinese forum would probably be the best way to resolve the issue. If there is actually a jQuery bug lurking here, please reopen and attach a complete test case file with script and html.