django - 编辑表格中的单元格保存到 django 模型
问题描述
我有一张员工表。我正在使用 $http 加载数据并使用 ng-repeat 将其打印在网页上。我想编辑每一行的内容。HTML:
tbody ng-repeat="list in data" >
<tr ng-hide="edit" ng-click="edit=true">
{% verbatim %}
<td> {{$index + 1}}</td>
<td>{{ list.associate_nbr }}</td>
<td>{{ list.per }}%</td>
<td>{{ list.count }}</td>
<td>{{ list.sample_per }}%</td>
<td>{{ list.sample}}</td>
<td><input type="text" value="{{ list.focused
}}"></td>
<td><input type="text" value="{{
list.random_field }}"></td>
</tr>
{% endverbatim %}
主.JS
(function(){
'use strict';
angular.module('sampling.demo',[])
.controller('SamplingController', ['$scope','$http',SamplingController]);
function SamplingController($scope,$http)
{
$scope.data = [];
$http.get('/sample/').then(function(response){
$scope.data = response.data;
});
}
}());
当用户单击它时,我想编辑最后两个字段。
解决方案
推荐阅读
- kubernetes - Kubernetes-dashboard empty : 禁止所有资源
- twitter-bootstrap - 为什么 bootstrap col 上的文本颜色是蓝色的?以及如何仅使用 Bootstrap css 重新设计我的页面
- jquery - 数据中带有 location.href 的 jquery ajax 帖子不起作用
- c# - 从复选框中选择多个项目并将现有 SQL Server 查询添加到 ASP.NET 中的 if 语句中
- python - 无法使交互式 matplotlib 绘图工作(不在 Jupyter 模式下时)
- c++ - 为什么 std::map 没有 FindOrNull 方法
- c++ - Qt Creator + CMake 不解析文件
- c# - 是否可以在调试时声明 C# 方法/函数?
- python - 使用 pandas 压缩一个数据帧,使用一个数据帧中的值填充一个新的数据帧
- string - 优化速度和字符串的问题