DatePicker Not Working while Cloning in MVC Editable

ganesh mandlik

I am facing issue while executing and cloning datepicker. The base datepicker working fine, however the cloned datepicker not working. Can somebody please help me with this. Struggling to get is solve. Here is what I tried:

<input type="button" class="addbutton" id="addfield_button" style="font-size: x-small; color: blue; vertical-align: middle" value="Add" />

<table id="mitigationsTable">    
    <tr><td>@(Html.Kendo().DatePicker().Name("datepicker").Value("10/10/2011").HtmlAttributes(new { type = "text" }))
        </td>
    </tr>
</table> 

<script type="text/javascript">
    $(document).ready(function () {
        $("#addfield_button").click(function (e) {           
            $("#mitigationsTable tr:first").clone().find("input").each(function () { }).end().appendTo("table");
        });
    });
NiallMitch14

Managed to solve this. Instead of using kendo datepicker to clone from, just make a generic editor in your HTML:

@Html.Editor("date_0", new { htmlAttributes = new { style="width:100%" } })

Whenever you click your clone button, get the new input element and use JQuery to intialize it with kendo date picker:

$("#mitigationsTable tr:first").clone().find("input").kendoDatePicker();

This will make the cloned elements have the datepicker.

In my case, I had the original input in a hidden div. If you make your first tr field hidden then did a clone with initialzing kendo datepicker on document ready, you should be able to have a datepicker by default when the page loads and then allow it to work for subsequent cloning.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Cloning is not working

From Dev

JQuery - cloning a datepicker

From Dev

MVC JQuery DatePicker not working in ie (works in Chrome)

From Dev

Datepicker not working in asp.net MVC

From Dev

JGit HTTPS cloning is not working

From Dev

Nodegit cloning not working?

From Dev

JGit HTTPS cloning is not working

From Dev

How to make datepicker cell editable?

From Dev

Making AngularStrap DatePicker Textbox Editable

From Dev

Kendo UI MVC Grid I cannot use a datepicker while editing

From Dev

dd-mm-yyyy format for datepicker of MVC is not working in Chrome

From Dev

Jquery ui editable is not working

From Dev

Editable JComboBox KeyPressed not working

From Dev

Exception while cloning environment with conda

From Dev

Why constructor is not executed while cloning

From Dev

Exception while cloning environment with conda

From Dev

Bootstrap datepicker is not showing calender after cloning in jquery

From Dev

Cloning the table rows in not working in js

From Dev

How to test closing of x-editable datepicker?

From Dev

How to Date field of datepicker non editable

From Dev

WPF DatePicker textbox white border not editable

From Dev

KnockoutJS: working example for editable grid

From Dev

New line is not working in editable div

From Dev

editable true in Jquery Grid is not working

From Dev

KnockoutJS: working example for editable grid

From Dev

SQL replace two records while cloning a row

From Dev

Issue with SourceTree while cloning a GitHub repository

From Dev

Packfile is truncated error while cloning Git repository

From Dev

How to solve an error while cloning a github repository