1

I have the code as follows:

 $(function () { jQuery("#list48").jqGrid({ datatype: "xml", url: 'server.java', mtype: "POST", colNames:['Inv No','Date'], colModel:[ {name:'id',index:'id', width:60,}, {name:'invdate',index:'invdate', width:90} ], width: 600, caption: "Grouping Array Data", loadComplete: function (data) { console.log("### data: " , data); //Document console.log("### data.length: " , data.length); //undefined } }); }) 

After server response the table is contained by data. Everythig looks correct. Is there any any idea why the data.length is undefined?

2
  • 1
    What do you mean by "Document"? If data is the xml document you loaded (like the docs indicate), then it does of course not have a .length property. What did you expect it to be? Commented Mar 30, 2014 at 17:56
  • @Bergi, I wanted to change the icon for each item of the first level of TreeGrid as described here. The commenter loaded the data using json hense there is a lenght property in that case. And in my case the response type is xml, that's why there is no a length property. I got it. Very thanks! Please, "post your answer" in order I can check the post as soleved. Commented Mar 30, 2014 at 19:42

1 Answer 1

1

You're loading your data as an XML document (datatype: "xml"), and you are getting a Document back as seen in the log statement. Those don't have a .length, but collections of child nodes which you can iterate.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.