Weird behavior of jqGrid row selection

前端 未结 1 1438
無奈伤痛
無奈伤痛 2021-01-28 17:07

I have this very unusual behavior, Let me describe the problem.

The jqgrid has 14 records all together, at first it is set to rowNum:10, when from the drop

相关标签:
1条回答
  • 2021-01-28 17:27

    You should test yourself the code which you post. You should carefully read the question with the answer. If you don't want to have the described problems you should set your questions in another way. Nevertheless I will answer on your current question.

    The current code contains many undefined functions and variabls. Moreover it has small syntax error. One from the most important is

    var grid = jQuery("#list1");
    var iconAlert;
    
    getColumnIndexByName = function (grid, columnName) {
        ...
    },
    grid = jQuery("#list1"),
    iconAlert = '<span class="ui-state-error" ...'
    

    You should not define the same variables twice and in any way sou should replace ';' at the ent of var iconAlert; to comma to define the variable getColumnIndexByName as a function.

    The code at the beginning (xml=xml.replace(/<productId>1/g, "<productId>"+productMap['1']);) I can't understand at all. Why you need to do strange modifications of XML as text if you has $xml and can use jQuery to select and modify any XML element.

    If you would continue to use so dirty code you can has more serious problems. I recommend you always verify your code in JSLint. You can include JSLint options for example

    /*global $, jQuery */
    /*jslint devel: true, browser: true, vars: true, white: true, plusplus: true*/
    

    After all the work with preparing the test example only the resulting code don't have the problems which you described.

    0 讨论(0)
提交回复
热议问题