That's interesting, but farther afield from CF then I want to
go now with my wee abilities. Sat I got the following to work with
cfajaxproxy. I got the idea from Ray Camdem's blog
http://www.coldfusionjedi.com/index.cfm/2008/3/3/Adding-an-ADD-button-for-cfgrid--Part-Deux.
It probably could be improved, but it seems to work:
<script type="text/javascript" >
<cfajaxproxy cfc="#strcomponentpath#"
jsclassname="diaproxy" />
diaproxy = new diaproxy();
diaproxy.setCallbackHandler(handleResult);
<!--- helper function to Get the current archive and
selected ID --->
function getArchiveArray() {
var booDocumentImaging =
document.frmSearchGrid.strsearchdb[0].checked;
var booFilenet =
document.frmSearchGrid.strsearchdb[1].checked;
var aryArchive = [];
// If true then was selected
if (booDocumentImaging) {
//strsearchdb
aryArchive[0]= "DocumentImaging";
//intdocId
aryArchive[1]=
ColdFusion.getElementValue("searchGrid","frmSearchGrid","diadocumentkey");
}
// If true then Filenet was selected
else if (booFilenet) {
//strsearchdb
aryArchive[0]= "Filenet";
//intdocId
aryArchive[1]=
ColdFusion.getElementValue("searchGrid","frmSearchGrid","diafilenetkey");
}
else {
// should not happen
}
<!--- return array --->
return aryArchive;
}
function deleteSelectedIndex() {
// Deletes the selected record and provides appropriate
warnings
var aryArchive = getArchiveArray();
var strsearchdb = aryArchive[0];
var intdocId = aryArchive[1];
// Make sure they really want to do this
if (confirm("Do you really want to delete record id = " +
intdocId + "?")) {
// If Yes, Call the CFC passing these parameters and return
data as struct to handleResult()
diaproxy.deletediadocument(strsearchdb, intdocId);
//else return
}
}
function handleResult(sResult){
switch(sResult["strAction"]) {
case "create":
break;
case "update":
break;
case "delete":
if (sResult["strError"]) {
// alert the user that the record was not deleted
alert("Unsuccessful: An error occured and record " +
sResult["intdocId"] + " was not deleted! " + sResult["strError"]);
}
else {
// refresh the grid data
ColdFusion.Grid.refresh("searchGrid", true);
// confirm to the user that the record was deleted
alert("Success: Record " + sResult["intdocId"] + " was
deleted.");
}
break;
default:
alert("Unsuccessful: Contact the Administrator. There seems
to be a problem.");
break;
}
}
</script>
<cfform name="frmSearchGrid" id="frmSearchGrid"
format="html" method="post" >
<cfinput type="button" name="btndeleteIndex"
id="btndeleteIndex" value="Delete Index"
onclick="deleteSelectedIndex()" disabled = "true" />
</cfform>
Thanks for your assistance.
Brian