RadiantQ jQuery Gantt Package
How to make reflect the bound data property changes into the gantt(view)?

Previous Topic  Next Topic 


To make reflect the bound data property changes into the gantt(view) you have to refresh the grid cell with currently changed item to update the view during Undo/Redo. Here is the code that shows how to do that.


$.ajax({

  .................

  .................

    success: function (data) {

               

        for (var i = 0; i < data.length; i++) {

            var resources = data[i].Resources;

            // For each task object

            for (var j = 0; j < resources.length; j++) {

                var tasks = resources[j].Tasks;

                var resource = resources[j];

                // Make RName fire PropertyChanged on value change.

                RadiantQ.Gantt.Utils.InjectGetAndSetOnData(resource, "RName");

                resource.PropertyChanged.subscribe(onPropertyChanged);


                function onPropertyChanged(data, args) {

                    if (args.PropertyName == "RName") {

                        var flexyGantt = $("#gantt_container").data("FlexyGantt");

                        var grid = flexyGantt.grid;

                        var curItem = flexyGantt.FlatItemsSource.GetItemFromDataSource(data);

                        // Refresh grid cell with current changed item to update the view during "Undo/Redo".

                        if (curItem)

                            grid.RefreshItem(curItem);

                    }

                }

                       

            }

        }


        self.jsonData = data;

        $.holdReady(false);

    }

});  


//Column definition.

var columns = [

        {

            field: "RName",

            title: "Name",

            editor: RadiantQ.Default.Template.FlexyGanttExpandableTextBoxEditor("nameConverter"),

            template: RadiantQ.Default.Template.FlexyGanttExpandableTextBlockTemplate("nameConverter"),

            isParentEditable: false,

            width:200

        }];

 

          


     



� RadiantQ 2022. All Rights Reserved.