PDA

View Full Version : Potential Bug with gridDeleteDocumentSuccess in UIView



Zakaroonikov
28 Aug 2007, 1:52 PM
I have changed the following in the UIView class from



gridDeleteDocumentSuccess: function(o) {
//alert("The document was successfully deleted.");
var row = o.argument;
var ds = this.grid.getDataSource();
var sm = this.grid.selModel;
var rowIndex = ds.indexOf(row);
if (rowIndex == ds.data.length) {
sm.selectRow(rowIndex);
} else {
sm.selectRow(rowIndex+1);
}
ds.remove(row);
},


To



/**
* Remove the row from the grid/data store after a successful AJAX document delete operation
* @param {Object} Ajax result set containing index of row to remove
*/
gridDeleteDocumentSuccess: function(o) {
//alert("The document was successfully deleted.");
var rowIndex = o.argument;
var ds = this.grid.getDataSource();
var sm = this.grid.selModel;
var row = ds.getAt(rowIndex);
if (rowIndex == ds.data.length) {
sm.selectRow(rowIndex);
} else {
sm.selectRow(rowIndex+1);
}
ds.remove(row);
},


As the argumnent being passed on a successful deletion is the index and not the actual row so instead I have to use getAt(index) to get the actual record to remove.

jratcliff
29 Aug 2007, 6:42 AM
Thanks! I haven't had the chance to test deletes. The one other piece I want to add is to first check to see if the user CAN delete the document before we even try doing the delete. Does anyone know what the Notes client does in the cases where you try to delete but don't have access? Do you get a prompt? Or does nothing happen?

~Jack

tony.westwell
29 Aug 2007, 11:38 PM
Jack, notes client puts up a message 'You are not authorised to perform that operation' when a user tries to delete a document but has not got the access. :)

Zakaroonikov
30 Aug 2007, 1:34 PM
Thanks! I haven't had the chance to test deletes. The one other piece I want to add is to first check to see if the user CAN delete the document before we even try doing the delete. Does anyone know what the Notes client does in the cases where you try to delete but don't have access? Do you get a prompt? Or does nothing happen?

~Jack

That may be a problem. I have been looking into checking the access levels but for some reason I cannot get the $$ReturnAuthorisationFailure to kick off from the database. This is needed because of the case with Author level access which causes problems throughout. If you have author access you will have the same problem if you try to edit a document that you do not have access to. As far as I know there is no way of checking without agents your access level to a particular document.

Please correct me if I am wrong as it would be great!!!