致命错误:未捕获错误:Class' jqGridRender'未找到

时间:2017-09-18 13:50:32

标签: php jqgrid

我的一个项目我需要以表格格式显示记录,为此目的我使用Guriddo jqGrid PHP来显示记录,但我得到的错误如下:

  

"致命错误:未捕捉错误:班级' jqGridRender'没找到....."

我正在使用PDO来连接数据库。 任何人都可以帮我解决这个错误吗?

请查看我的代码:

require_once 'jqgrid/jq-config.php';
// include the jqGrid Class
require_once ABSPATH."jqgrid/php/PHPSuito/jqGrid.php";
// include the driver class
require_once ABSPATH."jqgrid/php/PHPSuito/DBdrivers/jqGridPdo.php";
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// Tell the db that we use utf-8
$conn->query("SET NAMES utf8");

// Create the jqGrid instance
$grid = new jqGridRender($conn);
        // Write the SQL Query
        $sql = 'select member_id,members.full_name, email, mobile, member_type, state_name, city_name, location_name, IF(status=1,"YES","NO") as status, IF(validation_success=1,"YES","NO") as validation_success, profile_picture, date_added, date_updated, last_seen, isloggedin';

        $sql .= " from members ";

        $grid->SelectCommand = $sql;
        // Set the table to where you add the data
        $grid->table = 'members'; 
        // set the ouput format to json
        $grid->dataType = 'json';
        // Let the grid create the model
        $grid->setColModel();
        // Set the url from where we obtain the data
        $grid->setUrl('manage_member_grid.php');
        // Set some grid options
        $grid->setGridOptions(array("rowNum"=>100,"sortname"=>"full_name","sortorder"=>"asc","height"=>150,"multiselect"=>true,"hoverrows"=>true,"rowList"=>array(10,20,30,40,50,100),"shrinkToFit"=>false,"width"=>1140,"height"=>500));//

        //Set Primary Key for row
        $grid->setPrimaryKeyId("member_id");

        // Hide fields
        $grid->setColProperty("member_id", array("hidden"=>true));

        //Change some property of the full_name field
        $grid->setColProperty("full_name", array("label"=>array("Name")));
        $grid->setColProperty("full_name", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));

        //Change some property of the email field
        $grid->setColProperty("email", array("label"=>array("Email")));
        $grid->setColProperty("email", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));

        // Change some property of the mobile field
        $grid->setColProperty("mobile", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));//,"width"=>300,"lable"=>array("Added Date")
        $grid->setColProperty("mobile", array("label"=>array("Mobile")));

        // Change some property of the member_type field
        $grid->setColProperty("member_type", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));//,"width"=>300,"lable"=>array("Added Date")
        $grid->setColProperty("member_type", array("label"=>array("Member Type")));

        // Change some property of the State field
        $grid->setColProperty("state_name", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));
        $grid->setColProperty("state_name", array("label"=>array("Satate")));

        // Change some property of the City field
        $grid->setColProperty("city_name", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));
        $grid->setColProperty("city_name", array("label"=>array("City")));

        // Change some property of the Address field
        $grid->setColProperty("location_name", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));
        $grid->setColProperty("location_name", array("label"=>array("Location No")));

        // Change some property of the date_added field
        $grid->setColProperty("date_added", array("formatter"=>"date","formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"d/m/Y h:i a")));//,"lable"=>array("Added Date")
        $grid->setColProperty("date_added", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));
        $grid->setColProperty("date_added", array("label"=>array("Added Date")));
        $grid->setDatepicker('date_added');
        $grid->setColProperty('date_added', array("editable"=>false)); 
        // Change some property of the date_updated field
        $grid->setColProperty("date_updated", array("formatter"=>"date","formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"d/m/Y h:i a")));
        $grid->setColProperty("date_updated", array("label"=>array("Last Update")));
        $grid->setColProperty('date_updated', array("editable"=>false)); 

        // Change some property of the status field
        $grid->setColProperty("status", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));
        $grid->setColProperty("status", array("label"=>array("isActive")));

        // Change some property of the validation_success field
        $grid->setColProperty("validation_success", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));
        $grid->setColProperty("validation_success", array("label"=>array("isEmail Validate")));

        // Change some property of the profile_picture field
        $grid->setColProperty("profile_picture", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));
        $grid->setColProperty("profile_picture", array("label"=>array("Profile Picture"),"formatter"=>"js:formatLinkImages"));
        $grid->setColProperty('profile_picture', array("editable"=>false)); 
        // Change some property of the last_seen field
        $grid->setColProperty("last_seen", array("formatter"=>"date","formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"d/m/Y h:i a")));//,"lable"=>array("Added Date")
        $grid->setColProperty("last_seen", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));
        $grid->setColProperty("last_seen", array("label"=>array("Last Seen")));
        $grid->setDatepicker('last_seen');
        $grid->setColProperty('last_seen', array("editable"=>false)); 
        // Change some property of the isloggedin field
        $grid->setColProperty("isloggedin", array("searchoptions"=>array("sopt"=>array("cn","eq","ne","le","ge","gt","nc","bw","bn","ew","en"))));
        $grid->setColProperty("isloggedin", array("label"=>array("isLoggedin Now")));
        $grid->setColProperty('isloggedin', array("editable"=>false)); 

        // Enable toolbar searching
        $grid->toolbarfilter = true;
        $grid->setFilterOptions(array(
        "stringResult"=> true,
        "searchOperators"=>true
        ));


        // We can put JS from php
        $custom = <<<CUSTOM
        /*function formatLinkMember(cellValue, options, rowData) {
        return "<a class='button' href='#login_form' id='login_pop' onclick='getMemberDetails("+rowData.member_id+")' >"+rowData.full_name+"</a>";
        //return "<input type='button' value='somevalue' onclick='some_function'\>";
        }*/
        function formatLinkImages(cellValue, options, rowData) {
        var path = "'"+rowData.member_id+"', '"+rowData.profile_picture+"'";
        return '<a class="button" href="#login_form" id="login_pop" onclick="javascript:getImagesDetails('+path+');" >'+rowData.profile_picture+'</a>';
        //return "<input type='button' value='somevalue' onclick='some_function'\>";
        }

        CUSTOM;
        // Let set the code which is executed at end
        $grid->setJSCode($custom);


        //add on double clicl event (This will take to the View Records)
        $ondblclick = <<<DBLCLICK
        function(rowId, iRow, iCol, e)
        {
        if(rowId)
        {
        // this refers to grid
        $(this).jqGrid('viewGridRow',rowId,{});
        }
        }
        DBLCLICK;
        $grid->setGridEvent('ondblClickRow',$ondblclick);

        // add a custom button via the build in callGridMethod
        // note the js: before the function
        $buttonoptions = array("#pager",
        array("caption"=>"Pdf", "title"=>"Export to Pdf", "onClickButton"=>"js: function(){
        jQuery('#grid').jqGrid('excelExport',{tag:'pdf', url:'manage_member_grid.php'});}"
        )
        );
        $grid->callGridMethod("#grid", "navButtonAdd", $buttonoptions);

        // Enable navigator searching
        $grid->navigator = true;
        // Set which buttons should be visible
        $grid->setNavOptions('navigator',array("add"=>false,"edit"=>false,"del"=>false,"view"=>true,"excel"=>true,"recreateForm"=>true));
        // Enjoy
        $grid->renderGrid('#grid','#pager',true, null, null, true,true);

1 个答案:

答案 0 :(得分:0)

了解使用哪个版本的Guriddo Suito PHP非常重要。在最新版本中(无法记住哪一个)使用自动加载器类。

也许你可以尝试加载jqgrid的渲染类,即替换

// include the jqGrid Class
require_once ABSPATH."jqgrid/php/PHPSuito/jqGrid.php";

这一个

// include the jqGrid Class
require_once ABSPATH."jqgrid/php/PHPSuito/jqGridRender.php";
相关问题