admin管理员组文章数量:1123783
My Tabulator table uses tickCross in one column - I am interested in having javascript turn on the tick mark - actively - using javascript to tick it, without manually pressing the box. I was able to insert it using javascript, however when I save the file to a cvs, it is not included in the file when I reload. Right now I must manually click the checkmark "on" for it to save in the file. Is it possible to activate the tickCross checkmark using javascript (as though I clicked it) and still have it save with the file?
My Tabulator table uses tickCross in one column - I am interested in having javascript turn on the tick mark - actively - using javascript to tick it, without manually pressing the box. I was able to insert it using javascript, however when I save the file to a cvs, it is not included in the file when I reload. Right now I must manually click the checkmark "on" for it to save in the file. Is it possible to activate the tickCross checkmark using javascript (as though I clicked it) and still have it save with the file?
Share Improve this question edited yesterday mplungjan 177k28 gold badges180 silver badges240 bronze badges asked yesterday David BanningDavid Banning 131 silver badge3 bronze badges 2- Which language are you using (i.e. nodejs, angular, react etc)? Please add some steps or code to understand the problem. – sandeepchhapola Commented yesterday
- @sandeepchhapola tabulator.info/docs/6.3/format – mplungjan Commented yesterday
1 Answer
Reset to default 0You can use this for multiple
table.updateData([
{ id: "row1" , "example": true }
]);
or this for one
table.updateCell("row1", "example", true);
Here is a running example.
const table = new Tabulator("#example-table", {
height: "311px",
layout: "fitColumns",
columns: [
{ title: "ID", field: "id", width: 150 },
{ title: "Example", field: "example", formatter: "tickCross", formatterParams: { allowTruthy: true }
}
],
data: [
{ id: "row1", example: false },
{ id: "row2", example: false }
]
});
document.getElementById("update-button").addEventListener("click", function() {
table.updateData([{
id: 'row1', // update by id
example: true
}]);
});
<script src="https://unpkg.com/[email protected]/dist/js/tabulator.min.js"></script>
<link href="https://unpkg.com/[email protected]/dist/css/tabulator.min.css" rel="stylesheet">
<h1>Tabulator TickCross Example</h1>
<div id="example-table"></div>
<button id="update-button">Update First Row</button>
本文标签: tabulatorhow to insert tickCross using javascriptStack Overflow
版权声明:本文标题:tabulator - how to insert tickCross using javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736598835a1945180.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论