在添加/编辑窗口中选择JQGrid / Date [英] JQGrid / Date Picked within Add/Edit window

查看:189
本文介绍了在添加/编辑窗口中选择JQGrid / Date的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编辑内联时可以将日期选择器工作到JQGrid,但是我无法在添加/编辑窗口中使用它。有没有人有关于如何做这个的例子或一个我可以看看的例子?



从该网站的demo我试图做什么: http://www.the-di-lab.com/demo/apples



我看到我可以使用以下方法,但不知道如何整合它:

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


解决方案

看起来他们正在使用'afterShowForm'将日期/颜色选择器附加到div。


(查看源代码)

 
jQuery(#list)。navGrid(#pager ,{edit:true,add:true,del:true},
{width:400,height:400,closeAfterEdit:true,
afterShowForm:function(){$(#jsrs 。$($ / $ / $)$,
onclickSubmit:function(){$(#jsrs)。 pre>

(查看源代码)

 
http://www.the-对于colorPicker
$('#color'),可以使用ColorBicker({
onSubmit:function(hsb,hex ,rgb){
$('#color')。val(#+ hex);
},
onBeforeShow:function(){
$(this) ColorPickerSetColor(this.value);
}
})bind('keyup',function(){
$(this).ColorPickerSetColor(this.value);
} );


// Js for datePicker
$('#date')。DatePicker({
格式:'Ym-d',
日期:$('#date')。val(),
current:$('#date')。val )
start:1,
position:'bottom',
onBeforeShow:function(){
$('#date')。DatePickerSetDate($('#date' ).val(),true);
},
onChange:function(formated,dates){
$('#date')。val(formated);
}
});

感谢您找到这个例子,我也在寻找如何做到这一点。


I have been able to work the Date Picker into JQGrid when editing inline, but I am unable to use it inside the add/edit window. Does anyone have instructions on how to do this or an example I can look at?

demo from that site of what I am trying to do: http://www.the-di-lab.com/demo/apples

I read that I could use the following method but not sure how to integrate it:

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

解决方案

It looks like they are using 'afterShowForm' to attach a date/color picker to a div.
(view source)

jQuery("#list").navGrid("#pager",{edit:true,add:true,del:true},
                     {width:400,height:400,closeAfterEdit:true,
            afterShowForm:function(){   $("#jsrs").load("/demo/apples/jsrs"); },
            onclickSubmit:function() {  $("#jsrs").empty(); }
},

(view source)

http://www.the-di-lab.com/demo/apples/jsrs

//Js for colorPicker
$('#color').ColorPicker({
    onSubmit: function(hsb, hex, rgb) {
        $('#color').val("#"+hex);
    },
    onBeforeShow: function () {
        $(this).ColorPickerSetColor(this.value);
    }
}).bind('keyup', function(){
    $(this).ColorPickerSetColor(this.value);
});


//Js for datePicker
$('#date').DatePicker({
    format:'Y-m-d',
    date: $('#date').val(),
    current: $('#date').val(),
    starts: 1,
    position: 'bottom',
    onBeforeShow: function(){
        $('#date').DatePickerSetDate($('#date').val(), true);
    },
    onChange: function(formated, dates){
        $('#date').val(formated);
    }
    });

Thanks for finding this example, I was looking for how to do this as well.

这篇关于在添加/编辑窗口中选择JQGrid / Date的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆