Yelena - Thursday, May 21, 2009 12:31 PM:
tstickel - Thursday, May 21, 2009 4:48 PM:
Yelena;
Without reading all of your code in detail, I believe that all you need to do is to return false; after your AlertError instead of just a return;
The return false; triggers the Innovator grid object to abort the row insert.
Yelena - Friday, May 22, 2009 12:04 PM:
Hello Terry. Thanks for response.
I made a change below. I am getting an alert, but when click OK the row is still there.
The method executed as a grid event OnInsertRow
var
var
if
(!rfq_number) { a.AlertError("'You are required ......before creating a new relationship>."); return false; } rfq_number = parent.thisItem.getProperty("rfq_number"); thisItem = parent.thisItem;
Yelena - Friday, May 22, 2009 12:07 PM:
OOPS! It does not look right. Here is a code.
Again - I am getting an alert, but when click OK the row is still there.
var
var rfq_number = parent.thisItem.getProperty("rfq_number");
if
(!rfq_number) { a.AlertError("'You are required ...before creating a new relationship."); return false; } thisItem = parent.thisItem;
tstickel - Friday, May 22, 2009 12:39 PM:
Sorry, I looked at some code I had previously written to handle this and found out it was triggered on a onBeforeNew event for the relationship that was being presented in the gird. So it was not a grid OnInsertRow event. I am still sure it can be handled via the OnInsertRow event and will look for an example.
tstickel - Friday, May 22, 2009 12:44 PM:
I found it:
.......
var inItem = parent.thisItem;
var thisRel = inItem.getItemsByXPath("//Item[@id='" + relationshipID + "']").getItemByIndex(0);
var thisItem = parentItem.getItemsByXPath("//Item[@id='" + relationshipID + "']").getItemByIndex(0).getRelatedItem();
if (topItem.getProperty("classification").indexOf("/Part/Component") > -1) {
alert("You can not add any part to a Component's BOM");
inItem.removeRelationship(thisRel);
var objwin = top.aras.uiFindWindowEx(parentItem.getID());
if (objwin) {
objwin.updateRootItem(parent.item); // refresh grid with new entries
}
}
So the key is the inItem.removeRelationship(thisRel); statement
Yelena - Friday, May 22, 2009 2:45 PM:
Terry,
inItem.removeRelationship(thisRel); statement worked just fine.
Thanks a lot for your help