0

I have a table set up like this

<table class="table table-condensed">
        <thead>
            <tr>
                <th>Look</th>
                <th>Lease Company</th>
            </tr>
        </thead>
        <tbody data-bind="foreach: leaseApplicationLooks">
            <tr>
                <td data-bind="text: lookId"></td> 
                <td><select data-bind="options: $parent.leaseCompanies, optionsText: 'name', optionsValue: 'name', value: leaseCompany" /></td>
            </tr>
        </tbody>
    </table>

My view model:

leaseCompanies(datacontext.lookups.applicationCompanies);

This returns an array with a name, type fields

Depending on the row I want to display different options:

For example: Row 1, show all Type = 1, 2 Row 2, show all Type = 2

How would I go about doing this?

4

1 回答 1

0

为您想要的每种类型设置不同的数组。如果它们的长度是动态的,则设置您的 leaseApplicationLooks 的子可观察数组,并通过遍历您的租赁公司列表来填充这些数组。实际非常简单,只需使用普通的所有 javascript 循环

于 2013-09-07T14:27:14.410 回答