微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

表单 – 在JQgrid中编辑或添加新行时,如何在单击外部模态窗口时避免表单关闭?

有没有办法在添加或编辑行时避免表单关闭.
Jqgrid在我们的应用程序中工作得很好,但是有一点问题,当用户通过表单编辑编辑或创建一行并且用户在表单的模态外单击时,模式关闭并且更改丢失.避免这种行为是否可行?

解决方法

解决了!

只是,一定要在网格编辑中设置模态:true或添加选项,但一定要下载jqgrid进行模态编辑.见http://www.trirand.com/blog/?page_id=6.

这是我的网格(查找//选项),现在模式仅在单击保存或取消按钮时关闭

jQuery("#gridTipo").jqgrid(
            {

                url : 'obtenerTipodetallePorTipo.do?idTipo=0',datatype : "json",colNames : [ 'ID','Codigo','Descripción','Tabla','Codpadre','Nombre','Idioma' ],colModel : [ {
                    name : 'id',index : 'id',autowidth:true,hidden : true,width : 90,editable : true,editoptions : {
                        readonly : true,size : 10
                    }
                },{
                    name : 'codigoTipo',index : 'codigoTipo',autowidth : true,formoptions : {
                        rowpos : 2,label : "Codigo",elmprefix : "(*)"
                    },editrules : {
                        required : true
                    }
                },{
                    name : 'descripcionTipo',index : 'descripcionTipo',editoptions : {
                        size : 20
                    },formoptions : {
                        rowpos : 3,label : "Descripcion",{
                    name : 'tabla',index : 'tabla',formoptions : {
                        rowpos : 4,label : "Tabla",editrules : {
                        required : true
                    }

                },{
                    name : 'codpadre',index : 'codpadre',size : 25,defaultValue : function() {
                            var codPad = jQuery("#codpadreH").val();
                            return codPad;
                        }
                    }
                },{
                    name : 'nombre_tipo',index : 'nombre_tipo',formoptions : {
                        rowpos : 6,label : "Nombre",{
                    name : 'idioma',index : 'idioma',edittype : "select",editoptions : {
                        value : "${idiomasDin}"
                    },formoptions : {
                        rowpos : 7,elmprefix : "    "
                    }
                } ],rowNum : 10,pager : jQuery('#pgridTipo'),sortname : 'id',sortorder : "desc",viewrecords : true,width : '620',height : "250",editurl : "doPost.do",shrinkToFit:false,caption : "Administracion Tipos"
            }).navGrid('#pgridTipo',{
        add : true,search : false,del : false
    },//options
            {   modal: true,height : 220,width : 500,reloadAfterSubmit : true,recreateForm : true,closeAfterEdit : true,beforeInitData : function(FrmGrid_gridTipo) {
                    jQuery("#gridTipo").setColProp('codigoTipo',{
                        editoptions : {
                            readonly : true,size : 20
                        }
                    });
                    jQuery("#gridTipo").setColProp('tabla',size : 20
                        }
                    });
                    jQuery("#gridTipo").trigger('reloadGrid');
                    //alert("hola");
            }
            },// edit options
            {
                modal: true,closeAfteradd : true,{
                        editoptions : {
                            readonly : false,size : 20
                        }
                    });
                    jQuery("#gridTipo").trigger('reloadGrid');
                    //alert("hola");
            },recreateForm : true
            },// add options
            {
                reloadAfterSubmit : false
            },// del options
            {} // search options
            );

原文地址:https://www.jb51.cc/html/242552.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐