Skip to content

Instantly share code, notes, and snippets.

@yreynhout
Created August 5, 2012 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yreynhout/3265543 to your computer and use it in GitHub Desktop.
Save yreynhout/3265543 to your computer and use it in GitHub Desktop.
Viewmodels - Sample 6
<div class="setup-table">
<table>
<thead>
<tr>
<th colspan="2">Name</th>
</tr>
</thead>
<tbody data-bind="foreach: List.Items">
<tr data-bind="css : { selected : IsSelected }">
<td data-bind="click: Select.Command, text: Name.Value">
</td>
<td>
<button type="button" class="btn btn-small" data-bind="click: Delete.Command">
<i class="icon-remove"></i>
</button>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2" data-bind="with: Navigation">
<ul class="paging" data-bind="foreach: Pages">
<li data-bind="text: Label, click: NavigateToPage.Command, css: { selected: IsSelected }">
</li>
</ul>
</td>
</tr>
</tfoot>
</table>
</div>
<div class="span7" data-bind="with: Detail">
<div class="setup-detail">
<form id="form">
<div class="control-group" data-bind="with: Name, css: { error : Name.IsNotValid }">
<label for="name">Name</label>
<input id="name" name="name" type="text" data-bind="value: Value, enable: IsEnabled, valueUpdate: 'keyup', css: { error: IsNotValid }, hasfocus: HasFocus" />
<label for="name" generated="true" data-bind="text: ValidationMessage, visible: IsNotValid">
</label>
</div>
<div class="control-group" data-bind="with: Color">
<label for="color" class="control-label inline">Color</label>
<input id="color" name="color" type="hidden" class="miniColors" data-bind="value: Value, enable: IsEnabled, valueUpdate: 'keyup', colorpicker: { }" />
</div>
<div>
<button type="button" class="btn btn-primary" data-bind="click: Save.Command, enable: Save.IsEnabled">Save</button>
<button type="button" class="btn" data-bind="click: Cancel.Command, enable: Cancel.IsEnabled">Cancel</button>
</div>
</form>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment