0
knockoutjsを使ってテーブルにユーザーデータをバインドしているサンプルコードについては、特定のユーザー名をクリックするとそのユーザーの行の下に新しいtrが開きます特定のユーザーの詳細、しかし私はポップアップで開きたい。どうやってするか。続き はあなたの編集や、あなたのポップアップ上のユーザの更新編集変数を選択するたびのための観察可能な変数を持つことができ、私のhtml編集ボタンでノックアウトjsポップアップを開く方法
<tbody data-bind="foreach: Users">
<tr>
<td><span data-bind="css: { clickable: !$root.EditId() }, click: $root.Edit, text: Name"></span></td>
<td data-bind="text: LoginName"></td>
<td data-bind="text: SpaceName"></td>
<td data-bind="text: Email"></td>
<td data-bind="text: moment(LastLoginDate).format('M/DD/YYYY h:MM Z')"></td>
</tr>
<tr data-bind="visible: $root.EditId() === Id">
<td colspan="3">
<div id="EditEbillingPanel">
<div>
<em>E-Billing</em>
</div>
<div class="label">
<label data-bind="attr: { 'for': 'EbillingActive_' + Id }">Active: </label>
</div>
<div class="field">
<input data-bind="attr: { 'id': 'EbillingActive_' + Id }, checked: Ebilling() && Ebilling().IsActive" type="checkbox" />
</div>
<div class="label">
<label data-bind="attr: { 'for': 'EbillingEmail_' + Id }">Alternate email: </label>
</div>
<div class="field">
<input data-bind="attr: { 'id': 'EbillingEmai_' + Id }, enable: Ebilling() && Ebilling().IsActive, value: Ebilling() ? Ebilling().Email : null, valueUpdate: 'keyup'" type="email" />
</div>
<div class="label">
<label data-bind="attr: { 'for': 'EbillingReminderDays_' + Id }">Reminder: </label>
</div>
<div class="field">
<select data-bind="attr: { 'id': 'EbillingReminderDays_' + Id }, enable: Ebilling() && Ebilling().IsActive, value: Ebilling() ? Ebilling().ReminderDays : null">
<option value="0">Do not send me a reminder</option>
<option value="1">1 day before the due date</option>
<option value="2">2 days before the due date</option>
<option value="3">3 days before the due date</option>
<option value="4">4 days before the due date</option>
<option value="5">5 days before the due date</option>
<option value="6">6 days before the due date</option>
<option value="7">7 days before the due date</option>
</select>
</div>
</div>
<div id="EditAccountPanel">
<div>
<em>Password</em>
</div>
<div>
<label data-bind="attr: { 'for': 'ForcePasswordChange_' + Id }">Force password change: </label>
</div>
<div class="field">
<input data-bind="attr: { 'id': 'ForcePasswordChange_' + Id }, checked: ForcePasswordChange" type="checkbox" />
</div>
<div id="PasswordInstructions">
If user does not remember their password, enter temporary password here. User is required to have a password to enter a password change. Temporary password must be at least 8 characters long, with at least one numeric character and one of the following special symbols: [email protected]#$%^&*()+=
</div>
<div>
<label data-bind="attr: { 'for': 'TempPassword_' + Id }">Temporary password:</label>
</div>
<div class="field">
<input data-bind="attr: { 'id': 'TempPassword_' + Id }, enable: ForcePasswordChange, value: TempPassword, valueUpdate: 'keyup'" type="text" />
</div>
</div>
<div id="EditActionPanel">
<span data-bind="click: $root.Save, css: { clickable: $root.IsValid }">Save</span>
<span class="clickable" data-bind="click: $root.CancelEdit">Cancel</span>
</div>
</td>
<td colspan="2">
<div id="UserInfoPanel">
<div>
<em>User Info</em>
</div>
<!-- ko if: CreatedDate() -->
<div data-bind="text: 'Created: ' + moment(CreatedDate()).format('M/DD/YYYY h:MM Z')"></div>
<!-- /ko -->
<div>AutoPay: <span data-bind="text: IsEnrolledInAutoPay() ? 'enrolled' : 'not enrolled'"></span></div>
<div data-bind="text: 'Bank account info: ' + (BankAccountOnFile() ? 'Y' : 'N')"></div>
<div data-bind="text: 'Credit card info: ' + (CreditCardOnFile() ? 'Y' : 'N')"></div>
<div data-bind="css: { 'cc-expired': CreditCardIsExpired() || false }, text: 'Credit card expiration: ' + ((CreditCardExpiration() === '' || CreditCardExpiration() === '0/0') ? 'n/a' : CreditCardExpiration())"></div>
</div>
</td>
</tr>
</tbody>