asp.net-mvc – jqGrid中的日期选择器,简单的例子?

有没有人知道在jqgrid添加 jquery UI DatePicker(或其他一些)的例子?我正试图让它适用于内联编辑网格.

我找到了一些例子,但没有任何作用.我想要一些非常简单的东西!

我的网格设置(不知道这个问题是否属于nessecary):

$(function () {
    var lastsel;
    $("#list").jqgrid({
        url: '@Url.Action("ExampleData","Home")',datatype: 'json',mtype: 'GET',colNames: ['Namn','Födelsedag','Adress','Stad'],colModel: [
          { name: 'Name',index: 'Name',width: 130,editable: true },{ name: 'Birthday',index: 'Birthday',width: 80,// DatePicker for birthday 

          { name: 'Address',index: 'Address',width: 180,{ name: 'City',index: 'City',],pager: '#pager',rowNum: 10,rowList: [10,20,30],sortname: 'Name',sortorder: 'desc',viewrecords: true,gridview: true,width: 700,onSelectRow: function (id) {
            if (id && id !== lastsel) {
                jQuery('#list').jqgrid('saveRow',lastsel);
                jQuery('#list').jqgrid('editRow',id,true);
                lastsel = id;
            }
        },editurl: '@Url.Action("Incoming",caption: 'Kontaktpersoner'
    });

    jQuery("#list").jqgrid('navGrid',"#pager",{ edit: false,add: false,del: true });
    jQuery("#list").jqgrid('inlineNav',"#pager");

解决方法

正如您在 jqGrid documentation中可以看到的那样,有一个dataInit选项.您应该记住,在将元素插入DOM之前引发此事件,因此使用setTimeout只是为了安全:

{ name: 'Birthday',editable: true editoptions: { dataInit: function(el) { setTimeout(function() { $(el).datepicker(); },200); } } },

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....