From bbbf28819b790828da9342bbcca2c45ffd9876d9 Mon Sep 17 00:00:00 2001 From: Safwan Samsudeen Date: Mon, 8 Apr 2024 02:09:14 +0530 Subject: [PATCH] feat: allow readonly --- src/bar.js | 2 +- src/index.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bar.js b/src/bar.js index a6a3be1..c3e08c3 100644 --- a/src/bar.js +++ b/src/bar.js @@ -152,7 +152,7 @@ export default class Bar { } draw_resize_handles() { - if (this.invalid) return; + if (this.invalid || this.gantt.options.readonly) return; const bar = this.$bar; const handle_width = 8; diff --git a/src/index.js b/src/index.js index dbff9e0..4fe24fe 100644 --- a/src/index.js +++ b/src/index.js @@ -98,6 +98,7 @@ export default class Gantt { popup_trigger: "click", custom_popup_html: null, language: "en", + readonly: false, }; this.options = Object.assign({}, default_options, options); for (let [key, value] of Object.entries(options.view_mode_padding)) { @@ -323,6 +324,7 @@ export default class Gantt { } bind_events() { + if (this.options.readonly) return this.bind_grid_click(); this.bind_bar_events(); }