-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
60 lines (52 loc) · 2.13 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://rawgit.com/alansferreira/js-editable.jquery/master/dist/js-editable.min.css" rel="stylesheet">
</head>
<body ng-app="app">
<div ng-controller="ctrl">
<table>
<tr ng-repeat="r in data.rows">
<td editable edt-value="r.cell1" edt-input="'#edt-input-text'" edt-auto-update="false" edt-on-commit="commit">{{r.cell1}}</td>
<td editable edt-value="r.cell2" edt-input="'#edt-input-text'">{{r.cell2}}</td>
<td editable edt-value="r.cell3" edt-input="'#edt-input-select'">{{r.cell3}}</td>
</tr>
</table>
</div>
<style>
.custom-input{
background-color: gray;
}
</style>
<input id="edt-input-text"/>
<select id="edt-input-select">
<option value="v1">value 1</option>
<option value="v2">value 2</option>
<option value="v3">value 3</option>
</select>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js"></script>
<script src="http://rawgit.com/alansferreira/js-editable.jquery/master/dist/js-editable-jquery.min.js"></script>
<script src="./js-editable-angular.js"></script>
<script>
var app = angular.module('app', ['ngEditable']);
//registerEditableDirective(app);
var ctrl = app.controller('ctrl', function($scope){
$scope.data = {
rows: [
{cell1:'cell11', cell2:'cell12', cell3:'cell13'},
{cell1:'cell21', cell2:'cell22', cell3:'cell23'},
{cell1:'cell31', cell2:'cell32', cell3:'cell33'},
]
};
$scope.commit = function(){
console.log($scope.data);
console.log('commit-cell1');
}
});
</script>
</body>
</html>