Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you clone the <code>tr</code> it clone all the content, it include the <code>javascript</code> create by the plugin. This cloned script uses the <code>id</code> of the <code>text field</code> to make it <code>auto complete</code>. This <code>id</code> and text field is required to change to make cloned autocomplete works.</p> <p>I use following script to change that ids:</p> <pre><code>&lt;script type="text/javascript"&gt; var counter = 1; function asd() { var cloneContent = "&lt;tr&gt;" + $("#firstTrToClone").html().replace(/giveAUniqueId/g, "giveAUniqueId" + counter++) + "&lt;/tr&gt;"; $("#tableId").append(cloneContent); } &lt;/script&gt; </code></pre> <p><strong>Following is my full working page:</strong></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;resource:autoComplete skin="default"/&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var counter = 1; function asd() { var cloneContent = "&lt;tr&gt;" + $("#firstTrToClone").html().replace(/giveAUniqueId/g, "giveAUniqueId" + counter++) + "&lt;/tr&gt;"; $("#tableId").append(cloneContent); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;g:form&gt; &lt;table id="tableId"&gt; &lt;tr id="firstTrToClone"&gt; &lt;td&gt; &lt;richui:autoComplete name="name" id="giveAUniqueId" action="${createLinkTo('dir': 'oauthCallBack/test')}"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/g:form&gt; &lt;button onclick="asd()"&gt;Clone&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Try it..,.</p>
    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.
    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