-
-
Save ajayvikas/3a13dc67f549b257ed30c455ace6fadc to your computer and use it in GitHub Desktop.
Repeater of Children issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./grid"></require> | |
<require from="./grid-column"></require> | |
<grid items.bind="orders"> | |
<grid-column field="id" title="ID"></grid-column> | |
<grid-column field="rate" title="RATE"></grid-column> | |
<grid-column field="qty" title="QTY"></grid-column> | |
<grid-column field="amount" title="AMT"></grid-column> | |
</grid> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App { | |
constructor() { | |
this.orders = [ | |
{id: 1, rate: 10, qty: 1, amount: 10}, | |
{id: 2, rate: 15, qty: 2, amount: 30}, | |
{id: 3, rate: 20, qty: 3, amount: 60}, | |
]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {customElement, bindable, inlineView} from 'aurelia-framework'; | |
import {Grid} from "./grid"; | |
@customElement("grid-column") | |
@inlineView('<template><slot></slot></template>') | |
export class GridColumn { | |
@bindable field: string; | |
@bindable title: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div>First Block: Rendering Cells - before rendering header (Nothing get rendered)</div> | |
<div repeat.for="item of items"> | |
<label repeat.for="column of columns"> | |
${item[column.field]} | |
</label> | |
</div> | |
<div>Rendering Header (Works fine)</div> | |
<div> | |
<label repeat.for="column of columns"> | |
${column.title} | |
</label> | |
</div> | |
<div>Second Block: Rendering Cells - after rendering header (Works fine)</div> | |
<div repeat.for="item of items"> | |
<label repeat.for="column of columns"> | |
${item[column.field]} | |
</label> | |
</div> | |
<slot></slot> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {inject, customElement, children, bindable, BindingEngine, Disposable} from 'aurelia-framework'; | |
import {GridColumn} from "./grid-column"; | |
@customElement("grid") | |
export class Grid { | |
@children("grid-column") columns; | |
@bindable items = []; | |
attached() { | |
console.log(this.columns); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<style> | |
label { | |
display: inline-block; | |
width: 50px; | |
} | |
</style> | |
<script src="https://app-examples.azurewebsites.net/jspm_packages/system.js"></script> | |
<script src="https://app-examples.azurewebsites.net/config.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
<!-- | |
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> | |
<script> | |
require(['aurelia-bootstrapper']); | |
</script> | |
--> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment