(table, expandIt)
| 441 | |
| 442 | class ResultTableBehavior extends TableBehavior { |
| 443 | expand(table, expandIt) { |
| 444 | let data = this.data; |
| 445 | let header = table.first; |
| 446 | data.expanded = expandIt; |
| 447 | table.empty(1); |
| 448 | if (expandIt) { |
| 449 | header.behavior.expand(header, true); |
| 450 | if (data.items) { |
| 451 | for (let item of data.items) |
| 452 | table.add(new ResultRow(item)); |
| 453 | } |
| 454 | else { |
| 455 | searchService.searchResults(data.path) |
| 456 | .then(results => { |
| 457 | data.items = results; |
| 458 | application.distribute("onSearchResultsComplete", data) |
| 459 | }); |
| 460 | } |
| 461 | } |
| 462 | else { |
| 463 | header.behavior.expand(header, false); |
| 464 | } |
| 465 | } |
| 466 | onCreate(table, data) { |
| 467 | this.data = data; |
| 468 | this.expand(table, data.expanded); |
no test coverage detected