MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / updateOptions

Function updateOptions

lib/test/angular/1.4.3/angular.js:26356–26444  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26354
26355
26356 function updateOptions() {
26357
26358 var previousValue = options && selectCtrl.readValue();
26359
26360 options = ngOptions.getOptions();
26361
26362 var groupMap = {};
26363 var currentElement = selectElement[0].firstChild;
26364
26365 // Ensure that the empty option is always there if it was explicitly provided
26366 if (providedEmptyOption) {
26367 selectElement.prepend(emptyOption);
26368 }
26369
26370 currentElement = skipEmptyAndUnknownOptions(currentElement);
26371
26372 options.items.forEach(function updateOption(option) {
26373 var group;
26374 var groupElement;
26375 var optionElement;
26376
26377 if (option.group) {
26378
26379 // This option is to live in a group
26380 // See if we have already created this group
26381 group = groupMap[option.group];
26382
26383 if (!group) {
26384
26385 // We have not already created this group
26386 groupElement = addOrReuseElement(selectElement[0],
26387 currentElement,
26388 'optgroup',
26389 optGroupTemplate);
26390 // Move to the next element
26391 currentElement = groupElement.nextSibling;
26392
26393 // Update the label on the group element
26394 groupElement.label = option.group;
26395
26396 // Store it for use later
26397 group = groupMap[option.group] = {
26398 groupElement: groupElement,
26399 currentOptionElement: groupElement.firstChild
26400 };
26401
26402 }
26403
26404 // So now we have a group for this option we add the option to the group
26405 optionElement = addOrReuseElement(group.groupElement,
26406 group.currentOptionElement,
26407 'option',
26408 optionTemplate);
26409 updateOptionElement(option, optionElement);
26410 // Move to the next element
26411 group.currentOptionElement = optionElement.nextSibling;
26412
26413 } else {

Callers 1

angular.jsFile · 0.70

Calls 5

addOrReuseElementFunction · 0.70
updateOptionElementFunction · 0.70
removeExcessElementsFunction · 0.70
equalsFunction · 0.70

Tested by

no test coverage detected