Having some trouble finishing up a particular app for our users because of one validation. I have built a way for the user to merge multiple line items at a time, but currently they are able to merge different types of parts together, which is not something we want them to be able to do. We want the new merged item to be only one part. This information is taken by adopting the chosen rows into a new model. Tried to do a validation with branching action framework, but it wasn’t looping through each row in the model. Working on putting together a snippet to handle this, but so far it’s not working right.
Previously, I had the problem that some of my variables were coming up as undefined. I think I’ve gotten around that problem for the most part.
Any suggestions would be welcome.
var params = argumentsu0],
$ = skuid.$;
// variables
var NumbersToMerge = skuid.model.getModel('NumbersToMerge');
var SamePart = true;
//Check each row and compare part field
$.each(NumbersToMerge, function(i, row){
//if not the same, change SamePart to false
if(this.Part != NumbersToMerge.getFirstRow().Part) {
SamePart = false;
}
});
//Check to see if trigger is false - if so, display error
if(SamePart === false) {
skuid.$.blockUI({ message: 'Cannot merge two different parts
' });
}