We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Enable and Disable Gantt Toolbar Buttons

Hi,

how can I disable and enable gantt toolbar buttons, based on a combobox selection for example?

Thanks,
Otto Machado.

PS: While sending this message I forgot to select the "Control" on the combobox, I received a message "Please select control" but the message was cleaned, and I had to type again.

1 Reply

JR John Rajaram Syncfusion Team January 29, 2015 06:39 AM UTC

Hi Otto,

Thanks for using Syncfusion products.

Query

Syncfusion Comments

How can I disable and enable gantt toolbar buttons, based on a combobox selection for example?

We can enable or disable Toolbar items in the Gantt control based on the combo box selection.

Please refer the following code snippets for more details.

Code snippets:

@(Html.EJ().Gantt("Gantt").

         

//...

ToolbarSettings(eve =>

       {

           eve.ShowToolbar(true);

           eve.ToolbarItems(new List<GanttToolBarItems>(){

                      GanttToolBarItems.Add,

                      GanttToolBarItems.Edit,

                      GanttToolBarItems.Delete,

                      GanttToolBarItems.Cancel,

                      GanttToolBarItems.Update

           }

       );

       Datasource(ViewBag.dataSource)

    )

@(Html.EJ().ScriptManager())

<script type="text/javascript">

//Function to enable or disable toolbar in combobox selection

        function onDataChange(args) {

            var ganttObject = $("#Gantt").data("ejGantt");

            if (args.itemId == 0) {

                //To enable toolbar in Gantt control

                if (!ganttObject.model.toolbarSettings.showToolbar)

                    ganttObject.model.toolbarSettings.showToolbar = true;

                ganttObject.reRenderChart();

            }

            else if (args.itemId == 1) {

                //To disable toolbar in Gantt control

                if (ganttObject.model.toolbarSettings.showToolbar)

                    ganttObject.model.toolbarSettings.showToolbar = false;

                ganttObject.reRenderChart();

            }

        }

</script>

.

PS: While sending this message I forgot to select the "Control" on the combobox, I received a message "Please select control" but the message was cleaned, and I had to type again.

We were able to reproduce the issue and we have confirmed this as bug and logged a report on this. Also we have created a support incident under your account to track the status of this issue.

Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

 

Please let me know if you have any questions.

We have also prepared a sample based on this. Please find the sample in the following location:

Sample: http://www.syncfusion.com/downloads/support/directtrac/118064/SQLinMVC_Toolbar2031321672.zip

Please let us know if you require further assistance on this.

Regards,
John. R



Loader.
Live Chat Icon For mobile
Up arrow icon