Saturday 21 April 2012

Cannot get item from listitemcollection in Javascript client object model sharepoint 2010

I was wokring with a requirenment with Javascript client obejetc model where I had to load a colletcion of items and then navigate through each item and get the values.

I have always used var ListEnumerator = this.allItems.getEnumerator(); to get itemhandler and then I would navigate by getting the current item but this time when I used it I was presented by an nice error about ListEnumerator.get_current(); being null although I could get the number if items in my itemcollection.

After a lot of debugging the only thing that worked for me here is getting the current item from items colletcion was using a items loop which will run till itemcount and get item by items.get_item(i) method. I dont know the reason for this but getting items via enumerator does not work at all, nither does items[0].
You can check my post Here

No comments:

Post a Comment