Cheeky question - hiding a row using GetListItems

Feb 28, 2012 at 10:07 PM
Edited Feb 28, 2012 at 10:11 PM

Hi - I'm new to jquery and spservices - but both have become invaluable in advancing my projects - many thanks!

I appreciate that this is probably not an appropriate question for the forum - but I'm now at a loss to progress my code due to limited knowledge.

I have a number of lists displayed on a page. I need to find an item (keyItem) in a column then temporarily hide a row (or any row with that item in that column) in a specific list on the page (e.g. not permanently remove it) - I've searched everywhere - but there's so much I dont know.

The code below will take me to finding the item in a row in the right list (that appears on the page) - how do I then use the completefunc to hide any row in the list on that page that matches??

$(document).ready(function() {
keyItem = "this item";
    operation: "GetListItems",
    async: false,
    listName: "ListName",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {

        if ($(this).attr("ows_Title")===keyItem) {

              alert("item found");
           // ...and hide this row in table

Appreciate any help


Feb 28, 2012 at 11:46 PM


The code below does not show finding the item in a table (HTML) so I assume you are asking on how to remove the z:row from the xml... I assume you have other code to actually create the table. Try this... below the alert() insert:


Should work. Don't have the jQuery API handy, but I think .remove() works on XML.


Sent from mobile

Feb 29, 2012 at 8:52 AM

Thanks Paul - the above code is all I have - I have a test webpart page with two lists - and a CEWP with this GetListItems function.

Based on your reply it looks like I'm aproaching this the wrong way - I need to find the table first, then hide the row. My code above will get list items - but not interact with content already rendered on the page.

Thanks for your help - if you can point me in the right direction that would be incredibly helpful - eitherway thanks!


Feb 29, 2012 at 12:53 PM


That is correct... if you have a way to find the content on the already rendered table, then to hide the row in the table you would:


The example assumes that "this" is the Element that contains the text you are searching for... Usually, that is going to be the table column (<td>), but not always... so you should analyze the DOM tree to insure you are using the right selector.

Another approach: if you have control over the webpart that displays the table, you could edit the XSL to actually hide the rows "server-side", rather than use javascript on the client...

Good luck.


Feb 29, 2012 at 1:20 PM

Thanks Paul - and thanks for the pointers! I've got a few things to work on here - cheers!