Changing default behavior when adding a record from an editable list.

I have been having issues changing the default behavior when adding a record from a detail with an editable list. After adding the “IsEditable” attribute to my detail schema, whenever I want to add a record from the detail page a new row is added rather than showing the edit page for adding a new record. Is there a way I change this behavior?

Like 1

Like

2 comments
Best reply

Daer Alex, 

 

You can override the method openCardByMode in the detail schema, forcing the detail to open the card instead of adding a row. You can see the original method in the BaseGridDetailV2 schema in the NUI package. 

 

Daer Alex, 

 

You can override the method openCardByMode in the detail schema, forcing the detail to open the card instead of adding a row. You can see the original method in the BaseGridDetailV2 schema in the NUI package. 

 

Dennis Hudson,

 Thank you I was able to override this method and it worked. For anyone  trying to do a similar thing here is the code I added to my detail schema.

 

openCardByMode: function() {
     const cardState = this.get("CardState");
     const editPageUId = this.get("EditPageUId");
     const primaryValueUId = this.get("PrimaryValueUId");
     this.openCard(cardState, editPageUId, primaryValueUId);    
}

 

I just removed the if else statement from the original method:

 

if (this.getIsEditable() && cardState !== enums.CardStateV2.EDIT) { 
    this.addRow(editPageUId);
} else {
    this.openCard(cardState, editPageUId, primaryValueUId);
}

 

Show all comments