IBM / gantt-chart

IBM Gantt Chart Component, integrable in Vanilla, jQuery, or React Framework.
https://ibm.github.io/gantt-chart/packages/ibm-gantt-chart-docs/storybook
Apache License 2.0
215 stars 52 forks source link

processClick : how do i get id of any activity #61

Closed cemalmetan closed 1 year ago

cemalmetan commented 2 years ago

toolbar: [ 'title', 'search', 'separator', { type: 'button', text: 'Refresh', fontIcon: 'fa fa-refresh fa-lg', onclick: function (ctx) { ctx.gantt.draw(); }, }, 'fitToContent', 'zoomIn', 'zoomOut', // User specific toolbar components ], title: 'Proje Zaman Çizelgesi', // Title for the Gantt to be displayed in the toolbar timeTable: { renderer: [ { selector: function (object, ctx) { // Use this renderer if the display mode combobox is selected on 'Tasks' //console.log(object["id"]); //return ctx.gantt.colorMode === 'showTasks' }, text: function (activity) { // Instead of using a function, the text property could have been declared as: text : "TASK.NAME" return activity.TASK.NAME }, textOverflow: 'noDisplay', // Hide the text if it doesn't fit the width of the activity rectangle background: { // Uncomment line below to fix the index order of task names and therefore ensure tasks will always be displayed with the same color. //values : [ 'facade', 'ceiling', 'windows', 'moving', 'masonry', 'carpentry', 'roofing', 'plumbing', 'painting', 'garden' ], // Uncomment line below for using a palette replacement from the default Gantt palette. palette: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a"], getValue: 'TASK.NAME' }, color: 'automatic', // Text color will be white or black depending on the background color of the activity rectangle. tooltipProperties: function (activity, ctx) { var props = ['Start', new Date(activity.start).format(), 'End', new Date(activity.end).format()]; // Create a large amount of tooltip properties to demonstrate how the tooltip behaves on large property numbers. for (var i = 0; i < 50; i++) { props.push('Property ' + (i + 1)); props.push('Value ' + (i + 1)); } return props; } }, { selector: function (object, ctx) { // Use this renderer if the display mode combobox is selected on 'Houses' //alert(object["id"]); //return ctx.gantt.colorMode === 'showHouses' }, text: function (activity) { return "H" + activity.HOUSE; }, background: { values: function (object, ctx) { return Object.keys(ctx.gantt.houseTimeWindows); }, // Default palette is used getValue: 'HOUSE' // Access the HOUSE field of provided activity. eq to function(act) { return act.HOUSE; } }, color: 'automatic' // Text color will be white or black depending on the background color of the activity rectangle. }, { selector: function (object, ctx) { // Use this renderer if the display mode combobox is selected on 'All' //alert(object["id"]); //console.log(object["id"]); //return ctx.gantt.colorMode === 'showAll' },

                                    text: function (activity) {
                                        return "H" + activity.HOUSE + '-' + activity.TASK.NAME;
                                    },
                                    background: {
                                        values: function (object, row) {
                                            return Object.keys(row.gantt.houseTimeWindows);
                                        },
                                        getValue: 'HOUSE'
                                    },
                                    color: 'automatic' // Text color will be white or black depending on the background color of the activity rectangle.

                                },

                            ],
                            interactor: {
                                click : {
                                    processClick(p){
                                        console.log("asdsad");
                                    }
                                }
                            },

                        }
mustafavanli commented 1 year ago

could you do what you wanted?

cemalmetan commented 1 year ago

could you do what you wanted?

İstediğimi yaptım.. uzun uğraşlar sonunda

mustafavanli commented 1 year ago

Mümkünse kodunu paylaşabilme imkanın varmı gerçekten ihtiyacım var teşekkür ederim.

cemalmetan commented 1 year ago

mail adresi ilet atayım...

mustafavanli commented 1 year ago

vanlimustafa0@gmail.com

teşekkür ederim

mustafavanli commented 1 year ago

mail adresi ilet atayım...

.