angular-ui/ui-grid

uiGridValidateService.setValidator have newValue & oldValue param values reversed

Open

#5,059 建立於 2016年2月3日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)JavaScript (5,395 star) (2,496 fork)batch import
good first issue

描述

I was testing the sample in Plunkr and printed the newValue and oldValue parameters. Their values have been reversed. "NewValue" is showing old value and vice versa. Below is documented function with 2 alert statements.

uiGridValidateService.setValidator('startWith', function(argument) { return function(newValue, oldValue, rowEntity, colDef) { if (!newValue) { return true; // We should not test for existence here } else { alert('newValue ' + newValue); alert('oldValue ' + oldValue); return newValue.startsWith(argument); } }; }, function(argument) { return 'You can only insert names starting with: "' + argument + '"'; }

);

  • Nishat.

貢獻者指南