Using Javascript to remove quicklaunch node on sharepoint 2010

1k views Asked by At

I'm trying to remove dynamicaly a Quicklaunch item in SharePoint 2010 (SandBoxed) using javascript Client object Model.

The code runs correctly. The selected item is deleted from my current quickLaunchNodeCollection but when I reload my quickLaunchNodeCollection the selected item is still existing.

function RemoveQuickLaunchNode() {
  var clientContext = new SP.ClientContext('/');
  this.nodeToRemove = this.quickLaunchNodeCollection.get_item(8);
  this.nodeToRemove.deleteObject();

  clientContext.executeQueryAsync(Function.createDelegate(this, this.onRefresh), Function.createDelegate(this, this.Failedmsg));
 }

Someone can help me ??

Thanks .

1

There are 1 answers

0
Miky_g971 On BEST ANSWER

It was a context problem. clientContext and quickLaunchNodeCollection have not the same context, so nodeToRemove can't be deleted.