Completed
Last Updated: 15 Aug 2018 05:56 by ADMIN
ADMIN
Marin Bratanov
Created on: 13 Aug 2018 12:48
Category: Gantt
Type: Bug Report
1
Client-side custom fields getters/setters work only with the last custom field data
The task's get_customFieldClientName() and set_customFieldClientName(newValue) methods always work with the last custom field in the CustomFields collection.

There are two workarounds until an official solution is available:
- instead of the function getter, use task._data.customFieldClientName . The setter cannot be worked around that easily. This can work for you if you only show data or do not need to edit custom fields
- OR, add the following function override at the end of the </form>  - a sample is attached below
        <script>
            Telerik.Web.UI.RadGantt.prototype.initializeCustomFields = function () {

                var _createCustomFieldGetterAndSetter = function (fieldName) {
                    var taskType = Telerik.Web.UI.GanttTask;
                    taskType.prototype["get_" + fieldName] = function () {
                        return this._data[fieldName];
                    };

                    taskType.prototype["set_" + fieldName] = function (value) {
                        var updateInfo = {};
                        updateInfo[fieldName] = value;
                        this._data[fieldName] = value;
                        this._update(updateInfo);
                    };
                }

                var customFields = this.get_customTaskFields();
                for (var i = 0, length = customFields.length; i < length; i++) {
                    _createCustomFieldGetterAndSetter(customFields[i].clientPropertyName);
                }
            }
        </script>
Attached Files:
0 comments