Search code examples
jqgrid

Length of colNames <> colModel! error in JQGRID


I am using data of following format in jqgrid "1201.2564.2548.25456". This throws the following error while displaying the data from JSON: Length of colNames <> colModel! ANy idea.. is it related to format of the data?


Solution

  • Both parameters colNames and colModel are arrays, which have to have the same number of elements (the length). You use different length. One of possible error which I have seen before was the usage of strings "[...]" instead of arrays [...] as the value of colNames and colModel. As the result jqGrid code compared the length of the strings colNames and colModel instead of comparing the number of elements in arrays colNames and colModel. Such error could take place if you returns colNames and colModel from the server and you have used wrong JSON serialization on the server side.

    Thus you should verify that the type of colNames and colModel are arrays and both arrays have the same number of elements.