English 中文(简体)
在jqGrid内与JQuery Daypicker发生的问题,显示:
原标题:Problem with JQuery datepicker inside jqGrid with showOn : button
  • 时间:2009-10-10 03:39:23
  •  标签:

我使用jqGrid,我想将一名JQuery DayPicker纳入其中。 直到我增加<>how:纽伦/斯特隆>。 因此,ed子再工作。 我真的想要把这辆小卡车登在一顿点,因为日期是我行的第1个囚室,因此我使用线上ed,这样每排一个显示日期pi客:-。 如果我使用同一日期旁边的cker车选择,它就会发挥作用。

请帮助

function loadGrid() {
    var getUrl =  Transactions.aspx/GridData/?fundID=  + $( #fundID ).val();
    var lastSel = "";
    jQuery("#list").jqGrid({
        url: getUrl,
        editurl:  Transactions.aspx/Edit/ ,
        datatype:  json ,
        mtype:  GET ,
        colNames: [ Date ,  Invested ,  Nb Shares ,  Price ],
            colModel: [
      { name:  Date , index:  Date , width: 120, align:  left , editable: true,
          editoptions: {
              size: 10, maxlengh: 10,
              dataInit: function(element) {
                  $(element).datepicker({ dateFormat:  dd/mm/yy , constrainInput: false, showOn:  button , buttonText:  ...  });
              }
          }
      },
      { name:  Invested , index:  Invested , width: 100, align:  right , editable: true, edittype:  text  },
      { name:  NbShares , index:  NbShares , width: 110, align:  right , editable: true, edittype:  text  },
      { name:  UnitValue , index:  UnitValue , width: 150, align:  right , editable: true, edittype:  text }],
            onSelectRow: function(id) {
                if (id && id !== lastSel) {
                    jQuery( #list ).restoreRow(lastSel);
                    jQuery( #list ).editRow(id, true);
                    lastSel = id;
                }
            },
            pager: jQuery( #navbar ),
            viewrecords: true,
            height:  auto ,
            caption:  Transactions detail 
        }).navGrid( #navbar , { edit: false, add: true, del: true });
        jQuery("input[type=text]").css("width", "2em");
        jQuery("#navbar table").css("margin", "0");

    }
最佳回答

我拿不出你的全书,因此我可能有一些小的同学错误,但试图这样做。

不要将日期推到沉积物中,而是使用先天功能(oneditfunc)。

页: 1

{ name:  Date , index:  Date , width: 120, align:  left , editable: true },

改变你的当选 • 建立:

onSelectRow: function(id) {
    if (id && id !== lastSel) {
        jQuery( #list ).restoreRow(lastSel);

         // add a function that fires when editing a row as the 3rd parameter  
        jQuery( #list ).editRow(id, true, onGridEdit);//<-- oneditfunc

         lastSel = id;
    }
 },

利用你现有的对你在GridEdit上任日期的挑选办法,希望能这样做。

function onGridEdit(myRowID) {
    $("#" + myRowID + "_Date").datepicker({ dateFormat:  dd/mm/yy , 
        constrainInput: false, showOn:  button , buttonText:  ...  });

    // this will set focus on the Invested column so the datepicker doesn t fire
    $("#" + myRowID + "_Invested").get(0).focus();
} 

然而,自那天起,拖车向随机开枪,你可以简化日期,在选定该囚室时,让它开火。

function onGridEdit(myRowID) {
    $("#" + myRowID + "_Date").datepicker({ dateFormat:  dd/mm/yy  })

    // this will set focus on the Invested column so the datepicker doesn t fire
    $("#" + myRowID + "_Invested").get(0).focus();
}

如果你有yn错,请让我知道,我是在我的主编中使用日pi。

问题回答

日期抄录者需要知道该要素在OMD中的位置,在将该要素纳入OMS之前,会提出数据内容——这是问题,因此使用定时功能就象:

dataInit:function(elem){setTimeout(function(){
$(elem).datepicker(); }, 10); }

它应当解决这一问题。





相关问题
热门标签