简体   繁体   English

在可删除的可编辑网格中添加日历控件

[英]Add a calender control in knockout editable grid

I am trying to add a calender control in knockout editable grid I have added a calender in my needed Column when the grid rendered the first row added was attached with the calender but all the dynamically added rows I add (generated with the same id) not attached with the Calender. 我正在尝试在敲除可编辑网格中添加日历控件,当渲染的第一行添加的网格附加了日历,但是我添加的所有动态添加的行(使用相同ID生成)时,我在所需的列中添加了日历附有日历。

So what should i do ? 所以我该怎么做 ?

<td><input type="text" id="Calender" class='span11 required' data-bind="value: Date" /></td>

i'm using the following example: 我正在使用以下示例:

http://jsfiddle.net/rniemeyer/7RDc3/ http://jsfiddle.net/rniemeyer/7RDc3/

you have to do a date custom binding, if you dont want to write your own, there is a good datepicker here that is ready to work with ko. 您必须进行日期自定义绑定,如果您不想编写自己的日期, 这里有一个很好的datepicker,可以与ko配合使用。 docs are not very clear but just see source code and you will there is all you need. 文档不是很清楚,但是仅查看源代码,您将拥有所需的一切。

this is how you use it: 这是您的用法:

<input type="text" class="form-control input-sm borderless-control" placeholder="Seleccione Fecha"
                               data-bind="datepicker: $data.date, datepickerOptions: { format: 'LL' }" />

You will need moment js too wich is a really good library to work with dates 您将需要片刻js太过了,它是一个非常好的日期处理库

hope it helps! 希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM