а

Is it possible to programaticaly assign maximum value to editors?


#1

Hi everyone!

I’m trying to set a maximum value to a progress editor that depends on the task status, but I can’t find where to put some settings on how to control this maximum value.

const progressEditor = {
        type: "number",
        map_to: "progress",
        min: 0,
        max: 100
    }

So, is it possible to assign this max value depending on the task status?

Thanks!


#2

Hello,
The progress is saved in values between 0 and 1:

To make it work the way users expect it to work, you need to do the following things:

  1. Convert the displayed values in the grid by using the template and add the % symbol:
    https://docs.dhtmlx.com/gantt/desktop__specifying_columns.html#datamappingandtemplates
  2. Covert the actual values before opening the inline editor and after saving the changes. That can be done by using the onEditStart and onBeforeSave event handlers:
    https://docs.dhtmlx.com/gantt/desktop__inline_editors_ext.html#events

Here is the snippet that demonstrates how it works:
http://snippet.dhtmlx.com/0aabdb71f