View Full Version : How to Delete a document on click
pearlkrish
3 Apr 2008, 8:27 PM
Hi all,
When i right click on the grid i am displaying a drop down menu that contains "Delete Document". After i click on that option i am calling a function and inside that i have obtained the unid of the particular document. Now the problem is that inside that handler what code i should use to delete that document...Is it anybody there to provide a solution for me...
Thanks
JimStoner
7 Apr 2008, 9:42 AM
Conceptually, what you'd need to do is have your function call a lotusscript agent in that database. You could either use the EXT AJAX functions to place the call "behind the scenes", or do it by opening a new window. The url would be something like "delete_document?OpenAgent&unid=" with the document unid appended to the end.
The agent would then be called "delete_document" and would parse the query string to find out what the unid is, do any desired validation to make sure it is okay to delete (no child documents, etc.), delete the document, and respond with either success or failure message. If successful, you might need to do a refresh on the current page too, or else the existing entry for that document would still be there.
There may be a simpler way if there was a ?DeleteDocument url command with Domino, but I am not sure that exists. If not, then I think you have to use an agent as described above. I don't have any code snippets handy, but you probably can find one online with a google search.
Mike Amberg
8 Apr 2008, 4:30 AM
Hi
Check out the following:
http://www.codestore.net/store.nsf/unid/BLOG-20080404
pyrrhon
8 Apr 2008, 12:06 PM
a strategy based on json : .....
get a json lotusscript library (there is one free on the web somewhere), I use my own json library.
in Ext :
var dataCarrier = {actionType:'deleteDoc',unid:'234E78AF4324324A'}
Ext.Ajax.request({
url : notesUserActionUrl,//the domino agent url
method : 'POST',
xmlData : escape(Ext.util.JSON.encode(dataCarrier).replace('@',
'$hyper-a$')),
success : this.handleSuccess,
failure : this.handleFailure
});
On domino I get the json string :
bodyVar = Evaluate(|tmp := @Explode(Request_Content; "@"); @URLDecode("Domino";tmp)|, doc)
bodyString = Replace(bodyVar(0),"$hyper-a$","@")
From there decode the bodyString to an object (with a json ls scriptlib). Then jsonobject.getValue("actionType")(0) should give the action "deleteDoc"
The jsonobject.getValue("unid")(0) the unique id of the document
I m sorry I cant give you more code but it certainly can help you.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.