简体   繁体   English

jQuery pqgrid语法错误-缺少分号

[英]jquery pqgrid syntax error - missing semicolon

I hate to post a question regarding syntax, but this is driving me crazy. 我讨厌发布有关语法的问题,但这使我发疯。 I'm getting an error; 我遇到一个错误; missing semicolon. 缺少分号。 It's pointing to obj.dataModel: {. 它指向obj.dataModel:{。

I'm just getting started with pqgrid, so take it easy. 我刚刚开始使用pqgrid,所以请放轻松。

<script type="text/javascript">
    $(document).ready(function() {
        ListUsers=function(em){
            var emid = em.title;
            $('#userslistdiv').html('id-' + emid);
            $('#userslistdiv').show();
            //alert("it worked-" + emid);

        var obj = { width:700, height:400, title:"Grid From Array" };
        obj.colModel = [{ title: "IndivID", width: 100, dataType: "integer" },
            { title: "Lastname", width: 150, dataType: "string" },
            { title: "Firstname", width: 150, dataType: "float", align: "right" }];
        $("#userslistdiv").pqGrid(obj);
        obj.dataModel = [
            {dataType: "JSON"},
            {location: "remote"},
            {recIndx: "resourceid"},
            {url: "/cfc/basic.cfc?method=getIndivs&EmID=" + emid +"&queryFormat=column"},
            {getData: function (response) {
                return { data: response.DATA };
                }}];
        };

    });

</script>

I've started using this tool not so long ago, but you could use syntax checkers like JSLint or JSHint, the latter being a less picky about formatting errors. 我不久前就开始使用此工具,但是您可以使用JSLint或JSHint之类的语法检查器,后者对于格式化错误不太挑剔。 Online version can be found here , and you can find plugins for many text editors and IDEs. 可以在此处找到在线版本,并且可以找到许多文本编辑器和IDE的插件。

Pasting your original code indeed produces several missing semicolon errors, but the original error is the first found by the tool: Expected an assignment or function call and instead saw an expression . 粘贴原始代码确实会产生一些missing semicolon错误,但是原始错误是该工具首先发现的错误: Expected an assignment or function call and instead saw an expression

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM