- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 DataTables 创建可选择电话号码的列表,我的功能如下:
function search(areacode) {
areacode = typeof areacode !== 'undefined' ? areacode : 239;
$("#did_search").fadeIn();
var table = $('#example').DataTable( {
"bDestroy": true,
"ajax": "/Portal/manage/search_bulkvs/" + areacode,
"columns": [
{ "data": "did" },
{ "data": "city" },
{ "data": "state" },
{ "data": "action" },
],
"columnDefs": [
{ "visible": false, "targets": 3 }
]
} );
$('#example tbody').on( 'click', 'tr', function () {
var row_object = table.row( this ).data();
$("label[for = did_label]").text(row_object.action);
$('input[name="did"]').val(row_object.action);
} );
}
函数的末尾 $('#example tbody') -- 允许我从表中选择我需要的数据,并设置用于表单处理的标签/输入的值。但是,当我第二次运行此函数后,我无法再选择此数据。
我的调试导致了此错误:未捕获类型错误:无法读取未定义的属性“操作”
我以为每次运行该函数时都会定义 row_object,但看起来并非如此。
有人对如何在函数多次运行后从表中检索此数据有任何建议吗?
最佳答案
如果 ajax 调用替换了表的 tbody 元素,您将需要将委托(delegate)事件处理程序附加到不变的祖先(例如 $('#example').on
甚至$('#example').parent().on(
.
如果多次调用搜索(或在打开之前取消),您还希望避免重复设置处理程序。
例如
$('#example tbody').off('click').on( 'click', 'tr', function () {
var row_object = table.row( this ).data();
$("label[for = did_label]").text(row_object.action);
$('input[name="did"]').val(row_object.action);
} );
关于Javascript 关键字 "this"变为未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25849461/
我正在与 svgpath 合作为了操作 svgs,我需要更改坐标系,使 y 变为 x,x 变为 y。我的问题是有什么办法可以做到这一点。我尝试围绕点 0 0 旋转并按图形的高度进行平移。 最佳答案 作
我有一个来源 Observable那: 注册一些 BroadcastReceivers当它订阅时 取消订阅时取消注册。 我只希望在订阅者数量从 0 增加到 1,或从 1 增加到 0 时发生订阅副作用。
def string_transf(): input('Enter a word or string') #letters = 'abcdefghijklmnopqrstvwxyz'
这个问题在这里已经有了答案: 关闭 12 年前。 Possible Duplicate: Format Number like StackoverFlow (rounded to thousands
我是 R 的初学者,有一个任务,我必须创建一个函数,其中所有数字都重新缩放,Inf 映射到 1,-Inf 映射到 0。我了解如何进行重新缩放,我只是不知道如何添加到函数中,所以 Inf 变为 1,-I
我有一个由二进制值组成的单字节字符数组,我试图将它拆分成一个二维 int 数组(低 nybble 和高 nybble)。这是我的代码: int nybbles[2][4]; //[0][] is lo
有人可以解释为什么 FLEX 4.5 XMLDecoder 对我的 XML 数据这样做吗? var decoder:XMLDecoder = new XMLDecoder; var $object:O
问题: 我在使用 scanf() 时遇到问题。我从阅读论坛之类的地方知道 scanf() 在 C 中有很多问题,但我只是还在学习基础知识,所以我不知道所有的细节。 我想解决的代码片段。 #includ
我遇到了一个问题,其中 UIViewController.navigationController 变为 nil,我正在拼命寻找这个问题的答案。 UINavigationController 在应用程
我在做this教程。 基本上我的问题是,在 front_is_clear 为 false 后,它运行 Jump_over_hurdle,然后停止。 from my_lib import * while
我正在实现一个简单的 Drag'n'Drop Bahevior。首先我要订阅鼠标事件: protected override void OnAttached() { b
这是我的代码的简化版本: template TIterator findMaximalPosition(TIterator begin, TIterator end) { TIterator
大家好,我有这个代码 function computeChange(){ var change; var amountDue = parseFloat(document.getElementById(
就像我的其他问题一样,非常不言自明。问题是,当用户没有选择银行时,变量 bankMoney 在第一次调用 payDay 时会变为 NaN。不选择,它应该通过我的 random 函数进行随机化,但我认为
当我登录时,我已通过身份验证,但当我切换到另一个页面时,req.isAuthenticated 返回 false,并且我位于登录面板上。第二件事是,当我登录时,我不断收到错误“发送后无法设置 head
下面一行 filterM (\x -> Just (x > 0)) [2, 1, 0, -1] 输出 Just [2,1] 和行 filterM (\x -> Just (x > 0)) [] 显示
这可以完美地使用整数进行拓扑排序,但是我想让它与作为参数的字符串类型兼容。有人对如何从这里更改数据结构有任何指导吗?或者我是否必须重写整个内容才能使 [add.edge("a","b");] 工作?我
我正在尝试调试此应用程序,但存在一个大问题。当我尝试将数组保存到数据文件时,一切正常。但是,如果我关闭应用程序并重新打开数组中的 bool 值,则变为 nil。这是保存数组的代码: NSString
程序运行时,有一系列的ListView窗体。我们用项目(作为字符串)填充其中之一,并检查选择状态是否已更改。更改后,我们使用 FocusedItem.Text 获取所选项目的文本。第一次工作得很好,但
我正在编写一个 WP 插件,它连接到另一个 WP 站点,并获取一些数据作为返回(一些强大的条目,带有名称和其他内容)。 一切都很好,我的插件基本上按预期工作 - 但我今天注意到它有一些奇怪的编码问题
我是一名优秀的程序员,十分优秀!