select - 使用选择编辑器时如何在 Tabulator 中触发更新
问题描述
我正在尝试在 Tabulator 中获取选择编辑器的行 ID。我有几百行值,有些我想有一个值是,有些不是。当我更改值时,我需要知道它用于哪一行。这是我的桌子。
adtable = new Tabulator("#adtable", {
ajaxURL: "getinfo.php",
layout: "fitColumns",
pagination:"local",
placeholder: "No Data Set available",
paginationSize: 40,
paginationSizeSelector: [100, 200, 500, 1000],
columns: [{
title: "Key Name",
field: "keyname",
formatter: "textarea",
sorter: "string",
headerFilter: "input"
},
{
title: "Active",
field: "display",
editor: "select",
editorParams: {
values: ["Yes", "No"],
sortValuesList: "asc",
defaultValue: "Yes",
elementAttributes: {
maxlength: "10",
},
},
],
});
});
我在哪里可以放一个命令,它会给我行号。?我需要更新一个数据库记录。基本上,设置显示=是或否。我的偏好是tickCross,但也无法解决。
非常感谢任何帮助。使用制表符 4.9
解决方案
想了想……其实很简单。
{
title: "Active",
field: "display",
editor: "select",
editorParams: {
values: ["Yes", "No"], //create list of values from all values contained in this column
sortValuesList: "asc", //if creating a list of values from values:true then choose how it should be sorted
defaultValue: "Yes", //set the value that should be selected by default if the cells value is undefined
elementAttributes: {
maxlength: "10", //set the maximum character length of the input element to 10 characters
},
},
cellEdited: function(row) {
let thisrow = row.getData()
alert(thisrow.id + "is now " + thisrow.display)
}
},
在此处添加以帮助可能将头撞到墙上的其他人。我显然在想一些更复杂的事情。
推荐阅读
- javascript - Javascript - 在新请求中使用来自先前请求的数据
- c# - 从 SharePoint 列表中检索所有项目并将每个字段放入一个对象中
- angular - Angular:具有外键数组的类
- xslt - xsl 想要将以下 xml 转换为 html:
- javascript - 如何在 vuetify 中动态添加/删除带有选择/自动完成值的新表单行?
- php - 如何在 PHP 中将变量连接成数组值?
- javascript - 使用对象从数组中删除重复项
- python - Python:如何有效地打开和读取来自多个进程的 zipfile
- javascript - 在js中,你能检测到页面什么时候没有焦点吗?
- wordpress - WordPress:如何禁用所有页面的页脚