Added clear button on operation edit field.

This commit is contained in:
Alexis Lahouze 2013-01-08 18:03:25 +01:00
parent 30bf84480f
commit 318cc58074
2 changed files with 9 additions and 1 deletions

View File

@ -64,7 +64,7 @@
<script id="editTmpl" type="text/html"> <script id="editTmpl" type="text/html">
<tr data-bind="css: { 'error': sold() < 0 }"> <tr data-bind="css: { 'error': sold() < 0 }">
<td><input type="text" class="input-small" data-bind="dateValue: value_date" data-date-format="yyyy-mm-dd" id="value_date"/></td> <td><input type="text" class="input-small" data-bind="dateValue: value_date" data-date-format="yyyy-mm-dd" id="value_date"/></td>
<td><input type="text" class="input-small" data-bind="dateValue: operation_date" data-date-format="yyyy-mm-dd" id="operation_date"/></td> <td><div class="input-append"><input type="text" class="input-small" data-bind="dateValue: operation_date" data-date-format="yyyy-mm-dd" id="operation_date"/><button class="btn" type="button"><i class="icon-remove" id="operation_date_clear"></i></button></div></td>
<td><input type="text" class="input-xxlarge" data-bind="value: label"/></td> <td><input type="text" class="input-xxlarge" data-bind="value: label"/></td>
<td><input type="text" class="input-mini" data-bind="value: value"/></td> <td><input type="text" class="input-mini" data-bind="value: value"/></td>
<td data-bind="text: sold"></td> <td data-bind="text: sold"></td>

View File

@ -87,6 +87,10 @@ var ListViewModel = function() {
$("#operation_date").datepicker({format: "yyyy-mm-dd"}).on('changeDate', function(ev){ $("#operation_date").datepicker({format: "yyyy-mm-dd"}).on('changeDate', function(ev){
self.selectedItem().operation_date(new Date(ev.date.valueOf())); self.selectedItem().operation_date(new Date(ev.date.valueOf()));
}); });
$("#operation_date_clear").click(function(e){
self.selectedItem().operation_date(null);
});
}; };
self.cancel = function() { self.cancel = function() {
@ -122,6 +126,10 @@ var ListViewModel = function() {
$("#operation_date").datepicker({format: "yyyy-mm-dd"}).on('changeDate', function(ev){ $("#operation_date").datepicker({format: "yyyy-mm-dd"}).on('changeDate', function(ev){
self.selectedItem().operation_date(new Date(ev.date.valueOf())); self.selectedItem().operation_date(new Date(ev.date.valueOf()));
}); });
$("#operation_date_clear").click(function(e){
self.selectedItem().operation_date(null);
});
}; };
self.save = function() { self.save = function() {