作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
基于 AJAX 的 django 无休止分页有 2 个模板:1.主要issue_detail.html2.分页模板issue_detail_page.html
在 base.html 模板中,在 extra_header block 之前,我有:
{% inplace_static %}
我尝试在 issues_detail_page.html 中执行以下操作:
{% load endless %}
{% load inplace_edit %}
{% lazy_paginate 2 completed_actions using "completed_actions_page" %}
{% for action in completed_actions %}
<tr>
<td><a href="{% url 'action_detail' issuelist.id issue.id action.id %}">{{action.title}}</a></td>
<td>{% inplace_edit "action.owner" %}</td>
<td>{% inplace_edit "action.event_date" %}</td>
<td>{% inplace_edit "action.state" %}</td>
</tr>
{% endfor %}
{% show_more %}
但是 Ajax 加载的页面(表数据)不可编辑。
我检查了HTML,发现第一个/原始表数据是:
<span class="inplaceedit textinplaceedit enable">
而通过单击“更多”链接使用 AJAX 加载的页面稍后表数据是:
<span class="inplaceedit textinplaceedit">
有人可以建议如何实现这项工作吗?
最佳答案
试试这个:
$.getScript("{{ STATIC_URL }}js/jquery.json.js").done(function( script, textStatus ) {
$.getScript("{{ STATIC_URL }}js/jquery.inplaceeditform.js").done(function( script, textStatus ) {
var options = {"getFieldUrl": "/inplaceeditform/get_field/",
"saveURL": "/inplaceeditform/save/",
"successText": "Successfully saved",
"eventInplaceEdit": "click",
"disableClick": true,
"autoSave": true,
"unsavedChanges": "You have unsaved changes!",
"enableClass": "enable",
"fieldTypes": "input, select, textarea",
"focusWhenEditing": true};
var inplaceManager = $(".inplaceedit:not(.enable)").inplaceeditform(options);
inplaceManager.enable();
});
});
关于javascript - 如何进行 django 就地编辑以及基于 AJAX 的 django 无尽分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22797312/
我是一名优秀的程序员,十分优秀!