4

I came across a lot of articles and discussions by Marc D Anderson and Steve Workman regarding performance gains using .filternode(). I also read an article by Steve Workman

I also tried to understand the test cases provided in particular this

I was unable to interpret it completely though. I am extensively using SPServices for SharePoint 2010 even when it might be good to use built-in JavaScript Client Object Model.

I would like to get a few pointers and sample code on

Scenarios in which SPServices and in particular .filternode() should be effectively used

and

Whether it is a good practice to use SPServices even when job can be accomplished using in-built JS.

Also I would like to know what happens behind the scenes while using filternode (How the performance gain is achieved). When we write this:

jQ17(xData.responseXML).find('*').filterNode('z:row').each(function() 
{

});

Does 'z:row' indicate "till the last row" or we can use some other character in place of z

3

The function you are asking about is SPFilterNode, and it's part of SPServices. The reason the function even exists is to help with cross-browser compatibility.

Browsers other than IE won't work with the z:row namespace (or any other with a colon) properly. By providing SPFilterNode - based on Steve's excellent work - I'm able to give you cross-browser compatibility.

As for performance, that call is not going to be the bottleneck in your code. SPFilterNode simply filters the nodes in the jQuery object. Your subsequent processing of those nodes will be more time consuming.

For the record, every item returned from a call to GetListItems is contained in a z:row XML element.

  • Sir, do you mean this kind of an error when you say cross-browser "XMLHttpRequest cannot load mvms172:99999999/_vti_bin/Lists.asmx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.send @ jquery-1.9.1.min.js:19" – Yash Saraiya Oct 15 '15 at 12:45
  • 1
    No, it has nothing to do with cross-origin requests. When you use SPFilterNode, you already have the data back from the server. Browsers other than IE won't (or at least wouldn't at the time) provide the expected results for .find("z:row"). – Marc D Anderson Oct 15 '15 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.