【问题标题】:How to i trigger an update in Tabulator when using a select editor使用选择编辑器时如何在 Tabulator 中触发更新
【发布时间】:2021-02-21 02:36:13
【问题描述】:

我正在尝试在 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

【问题讨论】:

    标签: select tabulator


    【解决方案1】:

    再想一想……其实很简单。

        {
                    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)
                    }
                  },
    

    添加到此处是为了帮助可能会撞到墙上的其他人。我显然在想一些更复杂的事情。

    【讨论】:

      猜你喜欢
      • 2023-03-20
      • 2020-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多