未定义不是jqGrid中的函数

时间:2014-07-05 17:24:35

标签: jquery zend-framework jqgrid

我尝试设置jqGrid。我在zend框架2中使用它并在我的视图中附加这些脚本

echo $this->headScript()->prependFile($this->basePath( 'js\jquery.min.js' ) );
echo $this->headScript()->prependFile($this->basePath( 'js\jquery-jqGrid\jquery.jqGrid-4.6.0\js\jquery.jqGrid.src.js' ) );
echo $this->headScript()->prependFile($this->basePath( 'js\myScript.js' ) )

然而,在尝试

时出现错误
$( document).ready( function( ) {
jQuery("#editgrid").jqGrid({
    url:'editing.php?q=1',
    datatype: "xml",
    colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Closed','Ship via','Notes'],
    colModel:[
        {name:'id',index:'id', width:55,editable:false,editoptions:{readonly:true,size:10}},
        {name:'invdate',index:'invdate', width:80,editable:true,editoptions:{size:10}},
        {name:'name',index:'name', width:90,editable:true,editoptions:{size:25}},
        {name:'amount',index:'amount', width:60, align:"right",editable:true,editoptions:{size:10}},
        {name:'tax',index:'tax', width:60, align:"right",editable:true,editoptions:{size:10}},
        {name:'total',index:'total', width:60,align:"right",editable:true,editoptions:{size:10}},
        {name:'closed',index:'closed',width:55,align:'center',editable:true,edittype:"checkbox",editoptions:{value:"Yes:No"}},
        {name:'ship_via',index:'ship_via',width:70, editable: true,edittype:"select",editoptions:{value:"FE:FedEx;TN:TNT"}},
        {name:'note',index:'note', width:100, sortable:false,editable: true,edittype:"textarea", editoptions:{rows:"2",cols:"20"}}
    ],
    rowNum:10,
    rowList:[10,20,30],
    pager: '#pagered',
    sortname: 'id',
    viewrecords: true,
    sortorder: "desc",
    caption:"Editing Example",
    editurl:"someurl.php"
});
$("#bedata").click(function(){
    var gr = jQuery("#editgrid").jqGrid('getGridParam','selrow');
    if( gr != null ) jQuery("#editgrid").jqGrid('editGridRow',gr,{height:280,reloadAfterSubmit:false});
    else alert("Please Select Row");
});

选择器#editgrid很好,包含myScript,其他文件也是如此

1 个答案:

答案 0 :(得分:0)

您的遗失包括JavaScript中的语言文件。

~src / i18n / grid.locale-en.js

您可能还需要jquery-ui.js和相关的.css文件。