ecomfe / san-mui

A Set of SAN Components that Implement Google's Material Design
https://ecomfe.github.io/san-mui
MIT License
94 stars 31 forks source link

Configurable Table组件传入selected属性无效 #45

Closed sqliang closed 7 years ago

sqliang commented 7 years ago

desc:Configurable Table组件data数组项中的selected为true时,渲染出的表格没有默认选中此项 详见san-mui官网中的Configurable Table示例:https://ecomfe.github.io/san-mui/#/components/Table

解决方法: 因为再TR.js已经实现了selected功能,因此在ConfigurableTable.js中的模板代码片段需要传入获取的selected属性值,如下:

static template = `
        <table class="{{className}}">
            <ui-thead>
                <ui-tr>
                    <ui-td san-for="field in fields">{{field.title}}</ui-td>
                </ui-tr>
            </ui-thead>
            <ui-tbody>
                <ui-tr san-for="item in data" selected="{=item.selected=}">
                    <ui-td san-for="field in fields">{{field | renderField(item)}}</ui-td>
                </ui-tr>
            </ui-tbody>
        </table>
    `;