MCPcopy
hub / github.com/openstf/stf / LinkCell

Function LinkCell

res/app/device-list/column/device-column-service.js:492–524  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

490}
491
492function LinkCell(options) {
493 return _.defaults(options, {
494 title: options.title
495 , defaultOrder: 'asc'
496 , build: function() {
497 var td = document.createElement('td')
498 var a = document.createElement('a')
499 a.appendChild(document.createTextNode(''))
500 td.appendChild(a)
501 return td
502 }
503 , update: function(td, item) {
504 var a = td.firstChild
505 var t = a.firstChild
506 var href = options.link(item)
507 if (href) {
508 a.setAttribute('href', href)
509 }
510 else {
511 a.removeAttribute('href')
512 }
513 a.target = options.target || ''
514 t.nodeValue = options.value(item)
515 return td
516 }
517 , compare: function(a, b) {
518 return compareIgnoreCase(options.value(a), options.value(b))
519 }
520 , filter: function(item, filter) {
521 return filterIgnoreCase(options.value(item), filter.query)
522 }
523 })
524}
525
526function DeviceBrowserCell(options) {
527 return _.defaults(options, {

Callers 1

Calls 2

filterIgnoreCaseFunction · 0.85
compareIgnoreCaseFunction · 0.70

Tested by

no test coverage detected