You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two main ways to define the configuration of modalbox buttons:
205
205
206
-
- a short form:
206
+
- a short form:
207
207
208
208
~~~js
209
209
gantt.modalbox({
@@ -325,6 +325,84 @@ var box = gantt.confirm({
325
325
gantt.modalbox.hide(box);
326
326
~~~
327
327
328
+
##How Gantt Works with Modalbox Buttons
329
+
330
+
By default, the names of buttons are set as text. If the name of a button is set as an HTML element (e.g. to make the font bold, or add a material icon),
331
+
the result of the callback function on clicking the button will be *null*.
332
+
333
+
It happens as Gantt watches certain attributes of the clicked element's parent. If there aren't the expected attributes, Gantt will return *null*.
334
+
Besides, Gantt wraps all the elements you specify for the buttons into the `<div>` tags.
335
+
336
+
Thus if you return a string element when a text is clicked, its parent will be an empty `<div>` element and you'll get `null`.
337
+
But when a button is clicked outside the text, its parent is an element with all the necessary attributes, so you'll get some more expected result:
338
+
339
+
-*true/false* for the confirm box
340
+
- for the modalbox:
341
+
- the number of the element in an array (for the [short form](#configuringmodalboxbuttons))
342
+
- the value of the `value` parameter (for the [full form](#configuringmodalboxbuttons))
343
+
344
+
It means that if you want to set an HTML element as a button name, you need to wrap everything into two div elements that have the `data-result` attribute. For example:
If you need to use some other elements for a button, all the parent elements should also have the `data-result` attribute. In the example below
371
+
the `<u>` tags are used for the name of the button. So, they have the `data-result` attribute the same as the other two `<div>` parent elements of the button:
0 commit comments