如何在JqGrid中添加新记录?

问题描述

| 这是我单击添加记录时的代码,然后弹出新窗口,但不显示任何记录。 我是土井                       PHP的jqgrid
    <link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"themes/redmond/jquery-ui-1.8.2.custom.css\" />
    <link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"themes/ui.jqgrid.css\" />

    <script src=\"js/jquery-1.5.2.min.js\" type=\"text/javascript\"></script>
    <script src=\"js/i18n/grid.locale-en.js\" type=\"text/javascript\"></script>
    <script src=\"js/jquery.jqgrid.min.js\" type=\"text/javascript\"></script>
//这里我们在全局设置了altRows选项 jQuery.extend(jQuery.jgrid.defaults,{altRows:true));
    <script type=\"text/javascript\">

        jQuery(document).ready(function(){
        jQuery(\"#jsonmap\").jqgrid({
                url:\'example.PHP?q=4\',datatype: \"json\",colNames:[\'Inv No\',\'invdate\',\'Client\',\'Amount\',\'Tax\',\'Total\',\'Notes\'],colModel:[
                    {name:\'id\',index:\'id\',width:55},{name:\'invdate\',index:\'invdate\',width:90,jsonmap:\"invdate\"},{name:\'name\',index:\'name asc,invdate\',width:100},{name:\'amount\',index:\'amount\',width:80,align:\"right\"},{name:\'tax\',index:\'tax\',{name:\'total\',index:\'total\',{name:\'note\',index:\'note\',width:150,sortable:false}
                ],rowNum:10,rowList:[10,20,30],pager: \'#pjmap\',sortname: \'id\',viewrecords: true,sortorder: \"desc\",editurl:\'edit.PHP\',jsonReader: {
                    repeatitems : false,id: \"0\"
                },caption: \"JSON Mapping\",height: \'100%\'
            }).navGrid(\'#pjmap\',\"new\",{height:280,reloadAfterSubmit:false}); 

        });
    </script>

</head>
<body>
    <table id=\"jsonmap\"></table>
    <div id=\"pjmap\"></div>

</body>
    

解决方法

        对于要包含在“编辑”或“添加”对话框中的列,应使用editable:true属性。     

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...