Quantcast
Channel: DHTMLX Blog
Viewing all 208 articles
Browse latest View live

DHTMLX Gantt Chart 6.3 with Decimal Durations, Link Formatting, Drag-n-Drop of Multiple Tasks, and Even Smarter Rendering

$
0
0

We’re eager to deliver the next important update of our HTML5 Gantt chart library. This time, our development team has put a lot of effort into making DHTMLX Gantt even smarter and more flexible in v6.3.

From now on, Gantt users may benefit from a new intelligent module for converting duration units from days to hours or minutes and back and specifying task duration in decimal format. Additionally, now our Gantt has an MS Project-like way of showing dependency links in the grid. We have also polished up scrolling the timescale, drag-n-drop of multiple tasks, and fullscreen mode. And that’s not all the new features and improvements in v6.3 – just keep on reading!

Download a free 30-day evaluation version of DHTMLX Gantt 6.3 now >

Intelligent Duration Formatting [PRO]

In the previous versions of DHTMLX Gantt users could set task durations in whole numbers only. Starting with v6.3, they can specify the duration in fractional numbers as well. Now there’s no difficulty in assigning tasks that are 2.5 hours or 0.5 days long. Moreover, now Gantt is capable of converting minutes into hours, hours into days, days into months, etc. and vice versa.

Decimal Duration - DHTMLX GanttCheck the sample >

All that is possible due to a brand new Duration Formatter module, which is easy to set up.

Firstly, if you’d like to specify task duration in fractions of an hour precision (for example, set the duration to 0.5 hours), you’ll need to store the duration of tasks in minutes:

gantt.config.duration_unit = "minute";

Storing duration in hours will do as well and may be even better for the overall performance of the Gantt chart:

gantt.config.duration_unit = "hour";

When you are done with that, just create the formatter object as described below and add it to the Duration column of the grid, lightbox, and inline editors if necessary:

// formatting the duration
var formatter = gantt.ext.formatters.durationFormatter({
    enter: "day",
    store: "minute", // duration_unit
    format: "day",
    hoursPerDay: 8,
    hoursPerWeek: 40,
    daysPerMonth: 30
});
gantt.config.columns = [
    {name: "text", tree: true, width: 170, resize: true, editor: textEditor},
    {name: "start_date", align: "center", resize: true, editor: dateEditor},
    {name: "duration", label:"Duration", resize: true, align: "center",
        template: function(task) {
            return formatter.format(task.duration);
        }, width: 100},
    {name: "add", width: 44}
];
MS Project-Like Link Formatting [PRO]

In v6.3 DHTMLX Gantt provides an alternative way of linking tasks with each other via inline editors in the grid. It is based on MS Project formats of task dependencies:

  • finish_to_finish: “FF”
  • finish_to_start: “FS”
  • start_to_start: “SS”
  • start_to_finish: “SF”

Now end users can fill in cells of the grid with inline editors responsible for linking tasks by typing in abbreviations common for MS Project. For example, “2FF+1 day” abbreviation means that one of the tasks should be finished not later than one day after the end of the second task. Such link formatting can be enabled via the Link Formatter module. Read more in the documentation >
MS Project Task Dependencies in DHTMLX GanttCheck the sample >

Scrolling the Timeline with the Mouse

Working with huge Gantt charts is more convenient now, as end users can quickly scroll the timeline using mouse click and drag:
Scrolling the timeline - DHTMLX GanttCheck the sample >

This ability can be implemented with the help of the dhtmlxgantt_drag_timeline extension:

<script src="../codebase/ext/dhtmlxgantt_drag_timeline.js"></script>

The properties of the drag_timeline object allow you to control the behavior of Gantt elements while scrolling the timeline. The useKey property enables scrolling only when you press the specified key like Ctrl, Shift, Alt, etc. Besides, you can define which Gantt elements shouldn’t be affected in the process of scrolling by adding their CSS classes to the ignore property:

gantt.config.drag_timeline = {
      ignore:".gantt_task_line, .gantt_task_link",
      useKey: false
};

Additionally, we enlarged the API of horizontal scrolling in the timeline. Now developers can change the default Shift key to Alt or Meta keys in the horizontal_scroll_key property or even disable the horizontal scroll.

Displaying Tasks Outside of the Specified Time Range

Previously, users faced a problem of not being able to see the tasks that were assigned on dates outside of the limited time range of the Gantt chart. V6.3 copes with this issue by showing such tasks in the grid, even if they start and end before or after the specified time period. For instance, in the project below tasks 1 and 3 take place in January and March respectively. These tasks are listed in the grid, while the chart displays only the tasks scheduled for February 2020. Learn more in the documentation >
Tasks Outside the Timescale - DHTMLX GanttCheck the sample >

Drag-n-Drop of Multiple Tasks

Due to the ext/dhtmlxgantt_multiselect.js extension, it’s possible to select multiple tasks and manage them all together. In v6.3 the newly introduced drag_multiple method allows selecting several tasks by Shift or Ctrl-clicking and moving them simultaneously while saving their position in relation to each other:

gantt.config.drag_multiple = true;

The same approach can be applied to projects by using the drag_project method:

gantt.config.drag_project = true;

Drag-n-Drop of Multiple Tasks - DHTMLX GanttCheck the sample >

Other Important Updates
Smart Rendering Update

The release revamped the smart rendering techniques in order to further improve Gantt performance with large data sets. Now our updated Gantt chart is able to understand the exact position of custom elements such as baselines, deadlines, milestones, etc. and render them only when they are visible. It became possible due to the renderer configuration object, which keeps track of the visible area of the chart as well as the position of custom elements and decides whether to display them or not. Learn more in the documentation >

Full-Screen Mode

V6.3 brings out the ability to display not only the Gantt chart itself but also its header and other additional elements in the fullscreen mode.

How to Undo Custom Actions

Another essential update is the possibility to undo and redo changes you make to your Gantt from the code. Read more in the documentation >

Compatibility with RequireJS

V6.3 introduces some changes to the usage of RequireJS with DHTMLX Gantt. For more details, consult the migration article.

Inclusive End Dates in the Grid

In the previous versions, the grid column with the end date of tasks comprised exclusive dates. For example, the end date of the task starting on November 10 and lasting for 3 days would fall on November 14 in the grid. Whereas, the timeline displayed the duration of the task taking into account only inclusive dates (November 10-13). In order to avoid confusion and show inclusive dates everywhere, v6.3 offers a special template for redefining the format of end dates in the grid and lightbox.

We hope all the new features and updates will come in useful in your projects. We’re eager to get your feedback and continue further enriching the abilities of DHTMLX Gantt!

Please note that the features marked with PRO label are available under the Professional edition of paid licenses only.

We invite you to try out the latest version during a free 30-day evaluation.

Current clients may download dhtmlxGantt 6.3 in their Client’s Area.

Related Materials:

The post DHTMLX Gantt Chart 6.3 with Decimal Durations, Link Formatting, Drag-n-Drop of Multiple Tasks, and Even Smarter Rendering appeared first on DHTMLX Blog.


Customer Spotlight: dhtmlxSuite and dhtmlxScheduler for Pixel Nation

$
0
0

Headquartered in Richmond Hill, Ontario, Pixel Nation Inc. is a vendor-independent software development company. Their Core Framework platform was built with the help of the DHTMLX Suite and Scheduler libraries. Why the company chose our solutions and whether they met the expectations? Let’s find out!

Pixel Core is a development framework that provides common basic functionality out of the box. The product was designed to save developers from management tasks so they could focus on implementing specific business requirements.

Core Framework includes client management, robust roles and permissions, authorization, and authentication. Customers are equipped with reporting, scheduling, and scripting functionalities. Having outlined components at hand reduces time to market for new products.

pixel-core-login

The main requirements for choosing a UI framework were the richness and flexibility of its components. Out of many options available, the Pixel Nation team went for dhtmlxSuite controls library and dhtmlxScheduler event calendar.

The ability to initialize DHTMLX components without a learning curve was one of the key criteria. Moreover, our libraries have very extensive documentation and robust samples. The team thought API was consistent and admitted it was pretty easy to integrate different components into layouts.

pixel-core-registration

Pixel Nation extended DHTMLX and added some wrappers around components. Finally, the team received a powerful UI framework. It’s easy to build standard cases and extensible enough to develop complex single-page interfaces.

One of the Suite components, dhtmlxGrid, provides powerful support for infinite scrolling. Thanks to this functionality they can effectively display data in searchable and scrollable lists with an unlimited number of rows.

pixel-core-grid

DHTMLX Form maintains an intuitive view. Thus, end-users are able to clearly see what is missing or has invalid data.

Pixel Core also provides scheduled tasks support. Thanks to our Scheduler component, applications based on Core Framework allow monitoring and completing tasks at specific times.

pixel-core-schedule-timeline

Users can view task history displayed in a grid layout. They are able to analyze and configure long-running assignments. For instance, users can change timelines and limit the impact of heavy tasks to focus on other system’s functionality.

pixel-core-form

We at DHTMLX are grateful to Pixel Nation for sharing their case of using our libraries!

Do you want to tell us your own story? Fill in a form and receive a special bonus from our team.

The post Customer Spotlight: dhtmlxSuite and dhtmlxScheduler for Pixel Nation appeared first on DHTMLX Blog.

DHTMLX Diagram 2.2: Build Any Type of JavaScript Diagrams and Org Charts with Custom Shapes

$
0
0

Great news for DHTMLX Diagram users!

A brand new version of our JS diagram library 2.2 is out. Hurry up to get acquainted with new powerful abilities – adding any custom shapes you wish and building mixed org charts and diagrams.

Download a free 30-day evaluation version of DHTMLX Diagram >

Custom Shapes via SVG and HTML Templates

The release rolls out the most awaited ability to equip DHTMLX Diagrams with any types of shapes you desire. Now your opportunities are not restricted to a range of predefined shapes and you are free to build UML class diagrams, network diagrams, life cycle charts, Venn diagrams, and whatnot.

Venn diagramVenn diagrams are designed for finding patterns and defining logical relations among groups of objects, which are usually split into 3 sets. Overlapping areas stand for common characteristics of objects in question. Check the sample >

Network diagramNetwork diagrams usually depict the structure of telecommunication systems. Besides, they can be applied in project management for showing the process flow. Check the sample >

Life cycle diagram with sticky notesLife cycle diagrams make it easy to illustrate the stages of a product’s or project’s life cycle. In our example, the stages of the development process are designed with the help of yellow sticky notes. Check the sample >

UML class diagramUML Class Diagram for software engineering. Check the samples with HTML template and SVG template >

Embedding custom-made shapes into DHTMLX Diagram became possible due to newly introduced SVG and HTML templates. Now building a custom diagram takes just two steps:

  • Create a new SVG or HTML template for shapes:
  • // creating SVG template
    diagram.flowShapes.customShape = function(config) {
        var svg = '<svg width="'+ config.width +'" height="'+ config.height +
                                '" viewBox="0 0 '+ config.width +' '+ config.height +
                                '" fill="none" xmlns="http://www.w3.org/2000/svg">';
            svg += '<rect width="'+ config.width +'" height="'+ config.height +
                                '" fill="'+ config.fill +'"/>';
            svg += '</svg>';
        return svg;
    };

    or

    // creating HTML template
    diagram.flowShapes.customShape = function(config) {
        return `
            <section style="width:${config.width}px;
                height:${config.height}px; background: ${config.fill}"
    >
            <span style="font-size:${config.fontSize}px;
                color:${config.fontColor}"
    >${config.text}</span>
            </section>
        `
    };
  • Apply the template for the chosen shapes and prepare a data set for loading into Diagram. Check a detailed guide in the documentation >

New templates provide you with numerous options not only for adding brand new shapes but also for customizing the existing ones. For instance, you can equip org chart cards with icons, menu items, and any other custom elements required for your project:
Hospital org chartHospital org chart illustrating medical hierachy. Check the sample >

Combining Org Charts and Diagrams

And the cherry on the cake is that DHTMLX Diagram 2.2 enables you to mix flowchart and org chart shapes in one diagram by specifying particular types of shapes for each data item object:

// data to load
var data = [
    // the Org Chart shape
    {
        id: "1",
        text: "Chairman & CEO",
        title: "Henry Bennett",
        img: "../common/img/avatar-1.png",
    },
 
    // the Diagram shapes
    {
        id: "2",
        text: "Manager",
        type: "database",
        parent: "1"
    },
    {
        id: "3",
        text: "Technical Director",
        type: "process",
        parent: "1"
    },
    {
        id: "2.1",
        text: "Marketer",
        type: "database",
        parent: "2"
    },
    {
        id: "3.1",
        text: "Team Lead",
        type: "process",
        parent: "3"
    }
];
 
// initializing an org chart
var diagram = new dhx.Diagram("diagram", {
    type: "org",
    defaultShapeType: "img-card"
});
diagram.data.parse(data);

Read detailed instructions in the documentation >

Mixed org chartCheck the sample >

Export Diagrams to JSON from the Editor

Another novelty is the possibility to export your diagrams and org charts into the JSON format right from the editor. Our editors allow you to fine-tune diagrams and org charts on the fly via a simple and intuitive user interface. When you achieve the look and feel you need, you can export the result into the JSON format just in one click. After that, you are free to change our predefined shapes to custom ones using SVG and HTML templates, while preserving the structure and style of the whole diagram. Read more in the documentation >

DHTMLX Diagram 2.2 Round-Up

Summarizing the release news, here’s what you get with the updated Diagram 2.2:

We’re looking forward to receiving your feedback about the release of DHTMLX Diagram 2.2. Feel free to share your thoughts and ideas in the comments section below.

If you haven’t tried our Diagram library before, try it out during a free 30-day evaluation period.

We invite our current clients to visit their Client’s Area, where they can download the latest version 2.2.

The post DHTMLX Diagram 2.2: Build Any Type of JavaScript Diagrams and Org Charts with Custom Shapes appeared first on DHTMLX Blog.

How to Reorder Tasks in the Grid of JavaScript Gantt – DHTMLX Video Tutorial

$
0
0

While managing projects, users may face the need to change the order of tasks or move tasks between several Gantt projects. Today we’ll get acquainted with the ways of implementing this functionality in DHTMLX Gantt.

Our HTML5 Gantt provides two alternative ways of reordering tasks in the grid:

  • Via drag-and-drop
  • Via sorting

By default, both modes are disabled.

In order to enable the reordering of tasks by drag-n-drop, we need to set the order_branch option to ‘true’:

// ordering tasks only inside a branch
gantt.config.order_branch = true;

gantt.init("gantt_here");

The order_branch property activates the ‘branch’ mode that enables the reordering of tasks within the same nesting level.
JavaScript Gantt tasks reorderingCheck the sample >

Changing of the task position involves firing of the onBeforeTaskMove or onAfterTaskMove events; the first can be used to control where the task can be moved. To prevent moving to another sub-branch, use the onBeforeTaskMove event:

gantt.config.order_branch = true;
gantt.attachEvent("onBeforeTaskMove", function(id, parent, tindex){
    var task = gantt.getTask(id);
    if(task.parent != parent)
        return false;
    return true;
});
gantt.init("gantt_here");

Tasks reordering in JS GanttCheck the sample >
If your Gantt contains lots of tasks, the default mode of the branch reordering may slow down the performance. To speed it up, you can make use of the ‘marker’ mode:

gantt.config.order_branch = "marker";

In this mode, only the name of the task is reordered (on holding the left mouse key), and Gantt is re-rendered only when a task is dropped in the target position (on releasing the key):
Modes of task reordering - JS Gantt by DHTMLXCheck the sample >
Unlike the default mode, changing the task position doesn’t involve the firing of the onBeforeTaskMove or onAfterTaskMove events. To prevent dropping of a task in a particular position, we can use the onBeforeRowDragMove event instead. Note that it works only in the ‘marker’ mode:

// ordering tasks only inside a branch
gantt.config.order_branch = "marker";
gantt.attachEvent("onBeforeRowDragMove", function(id, parent, tindex){
        var task = gantt.getTask(id);
        if(task.parent != parent)
                return false;
        return true;
});
gantt.init("gantt_here");

Hope our tutorial turned out to be useful for you! If you’d like to experiment with DHTMLX Gantt yourself, download a free 30-day evaluation version.

Catch up with the previous tutorials from the series:

Subscribe to our YouTube channel to stay tuned: https://www.youtube.com/user/dhtmlx

The post How to Reorder Tasks in the Grid of JavaScript Gantt – DHTMLX Video Tutorial appeared first on DHTMLX Blog.

JavaScript/HTML5 Line & Spline Charts for Effective Forecasting

$
0
0

This article is a part of the series about DHTMLX JavaScript and HTML5 Charts – providing insights and best practices for the most popular graph types. Today, we’ll try to find out what a line chart is used for and what design tricks are needed to provide a better user experience.

Test our charting library during a 30-day free trial period.

JavaScirpt Line Chart by DHTMLX

A series of data points, joined by a line in a dot-to-dot fashion, can show startling results along its peaks and valleys. A simple line chart has the power to display the dynamic, highlight successes, and warn about potential dangers – all in seconds.

Horizontal line charts are primarily used for displaying behavior over a period of time: technology trends by a year, price dynamics over a quarter, website page visits per hour, and so on. In most cases, the way the data is trending allows predicting easily the results of data not yet recorded.

The time unit (years, months, days, etc.) is distributed evenly along the horizontal x-axis. The magnitude of each data element in the series is represented by its position on the vertical y-axis.

Specificities of a JavaScript Dynamic Line Chart

Dynamic Live Chart
Check the sample >

Dynamic or real-time charts are useful in displaying data that changes with time like a stock price, exchange rate, etc. These graphs are interactive, support animation and live updates.

Keys to Create a Simple JavaScript Line Chart
Consider Adding Data Comparison

It’s possible to include more than one line on the same axis. Thus, for instance, you can compare the number of tasks completed by each team for a certain period of time. Such a horizontal line graph depicts the totals with a separate line for a team.

However, if you’re building a multiple line chart, do not match too many data series. Graphs with more than 5 lines usually become cluttered and hard to understand.

Prefer Contrasting Colors for Multiple Lines

Users should not spend too much time trying to perceive your graph clearly. So when you draw a JavaScript line chart with multiple items, set clear contrasting colors. The color difference allows viewers to capture the aha moment quickly.

Simple Line Chart
Check the sample >

The palette you choose should be pleasing to look at. We recommend avoiding jarring and eyesore colors as well as variations of the same shade. If you have to build a JS line chart for a dashboard or business report, select a few brand colors harmonizing with each other.

Do Not Overwhelm Your JavaScript Line Chart with Text

When you add the text content, don’t be tempted to overcrowd the chart with too many symbols. There’s no need to mark every value on the x-axis and include all the data you have about the chart. Try to avoid bulky legends, paragraphs of texts, and multiple axis labels.

Line Chart Tooltip

Instead, you need readable titles and labels. The axis’ intervals have to be spaced evenly. Use special marks to label specific numbers that make sense for your datasets. Moreover, you can add tooltips to show the values when a user hovers over the data items.

Alternatives to a JS Horizontal Line Chart

We should note that line charts are not suitable for all kinds of data. For example, they fail in demonstrating percentages and proportions. Instead, consider choosing a pie chart. If you want to show how values differ in various categories or at the same time intervals, consider using JavaScript bar charts.

Differences Between a Line Graph and Spline Chart

Are you looking for a way to display changes over time that isn’t a line graph? Then you may experiment with a JavaScript/HTML5 spline chart. Line and spline charts are deeply related, the only difference is that the spline includes a fitted curve linking each data point in a series.

JavaScript Spline Chart by DHTMLX
Check the sample >

Why Choose DHTMLX JavaScript Visualization Library to Build a Line Chart

Our JavaScript charting library provides a simple and convenient way to integrate 10+ chart types into your web applications and interfaces. You can create Bar and X-Bar, Line and Spline, Area and Spline Area, Pie and Donut, Radar and Scatter graphs. Some of them have 3D variations.

Modern Design

DHTMLX follows the guidelines of a Material Design styling. We’ll help you build scalable web interfaces with a user-friendly look and feel.

Rich Configuration

A comprehensive DHTMLX Chart API allows configuring any element to achieve the desired appearance without a hitch. For instance, you can add multiple data items into your dynamic line chart. A new item will appear along the x-axis.

var config = {
    type:"line",
    scales: {
        "bottom" : {
            text: "text",
            showText: false
        },
        "left" : {
            maxTicks: 10,
            max: 100,
            min: 0
        }
    },
    series: [
        {
            value: "value",
            color: "#5E83BA",
            strokeWidth: 2
        }
    ]
};
 
var chart = new dhx.Chart("chart", config);
chart.data.parse([
    {
        value: Math.random() * 100,
        text: "u" + Date.now() + 1
    },
    {
        value: Math.random() * 100,
        text: "u" + Date.now() + 2
    },
    {
        value: Math.random() * 100,
        text: "u" + Date.now() + 3
    }
]);
function add() {
    chart.data.add({
        value: Math.random() * 100,
        text: "u" + Date.now()
    });
};

You can enable a legend and define its position. Indeed it should be available if your goal is to display more than one data series. The legend will provide information about the tracked data to help your users translate the graph.

var chart = new dhx.Chart("chart_container",{
    scales: {
        // scales config
    },
    series: [
        // list of series
    ],
    legend: {
        series: ["A", "B", "C"],
        valign: "top",
        halign: "right"
    }    
});

The API allows configuring a scale and setting a title for it. Besides, you can add a threshold line at any defined level to look for the particular value.

var chart = new dhx.Chart("chart_container",{
    type:"line",
    scales: {
        "bottom" : {
            text: 'month'
        },
        "left" : {
            padding: 10,
            max: 90
        }
    },
    series: [
        {
           value: 'company A',
           strokeWidth: 2
           // more options  
        }
    ]
});

Plus, our users can set maximum points to show an average number of values if your data is too large to display all the values in the chart.

var chart = new dhx.Chart("chart", {
    type:"line",
    maxPoints:100
});

Check the sample >

Simple Customization

DHTMLX Charting library lets you modify several aspects of the chart’s appearance. You can set the type of the point of the data item (circle, triangle, rectangular or rhombus state) and define its color. Series lines can be repainted and dashed. Moreover, developers can add new CSS classes in case they need specific options.

Conclusion

A line chart is a powerful data visualization tool for many different areas, including finance, marketing, and project management. It is extremely effective for monitoring trends over a certain period of time and making predictions. If two or more lines are on the graph, it can be used as a comparison between them.

DHTMLX Chart component is a part of the Suite UI library. You can download a dhtmlxChart free trial version as well as estimate a complete Suite kit with 20+ UI widgets included.

Our advanced solutions allow building rich web interfaces that are compatible with all modern browsers. Plus, we offer examples of smooth integration into applications based on React, Angular, and Vue.JS.

Access our documentation to get more information about dhtmlxChart features.

If you have questions for our team or want to share your opinion, do not hesitate to contact us.

The post JavaScript/HTML5 Line & Spline Charts for Effective Forecasting appeared first on DHTMLX Blog.

DHTMLX Suite 6.3 Introducing Grid Keyboard Navigation, Custom HTML Content in DHTMLX Components, and AJAX Helper

$
0
0

Our aspiring JS library of UI components has received a new update 6.3 with essential UX enhancements and deeper UI customization. From now on, end users can handily navigate through Grid cells with the help of keyboard shortcuts. Developers can create any kind of custom HTML content inside DHTMLX Grid, TreeGrid, Menu, Ribbon, Toolbar, and Sidebar components. Besides, the library obtains an AJAX helper for creating asynchronous web apps on the fly.

Get down to testing a new version 6.3 free of charge for 30 days >

Grid and TreeGrid Updated
Keyboard Navigation in Grid

V6.3 delivers a convenient set of keyboard shortcuts for navigating data in Grid. Due to a wide variety of shortcut keys, developers can greatly speed up the work with huge data tables. The default set of shortcuts enables users to scroll the grid up and down as well as navigate to the beginning or end of the data table, while the selected cell remains unchanged.

If needed, developers can quickly disable the default keyboard navigation:

var grid = new dhx.Grid("grid", {
    columns: [// columns config],
    data: dataset,
    keyNavigation: false
});

Additionally, the selection property enables developers to make the selection of cells possible for end users with the help of shortcut keys:
Grid keyboard navigationCheck the sample >

var grid = new dhx.Grid("grid", {
    columns: [// columns config],
    data: dataset,
    selection: "complex",
    keyNavigation: true // true - by default
});

Shortcut Keys - DHTMLX GridCheck the sample >

Besides, developers have broadened keyboard navigation in Grid to provide end users with shortcut keys for editing the content of cells. The Enter key opens an editor and allows saving changes, while the Esc key closes an editor without saving changes. To enable this feature, you need to set the editing property in the configuration object of Grid to true:

var grid = new dhx.Grid("grid", {
    columns: [// columns config],
    data: dataset,
    selection: "complex",
    editing: true,
    keyNavigation: true // true - by default
});

Key shortcuts for editing DHTMLX GridCheck the sample >

Custom HTML Content in Grid and TreeGrid

More customization opportunities have come with v6.3. The update brings out the ability to add any custom HTML content into the cells of Grid and TreeGrid right in the dataset. You can choose whether to use custom HTML elements either in all columns or only in particular columns of your data table.

For instance, in order to display countries’ flags together with their names in the first column of Grid, you need to specify the path to an image of the flag in the dataset and apply the htmlEnable: true configuration property:

var dataset = [
    {
        "country": "<span>China</span><img src='../flags/cn.jpg' />",
        "id": "1"
    }
];
 
var grid = new dhx.Grid("grid", {
    columns: [
        {
            width: 200, id: "country", header: [{ text: "Country" }],
            htmlEnable: true
        },
        {
            width: 150, id: "urban", header: [{ text: "Urban Pop" }]
        },
        // more columns
    ],
    data: dataset
});

Custom HTML content in DHTMLX GridCheck the sample >

Menu, Ribbon, Sidebar, and Toolbar Updated
Custom HTML Content

There is no limit to customization possibilities of your web apps with DHTMLX. V6.3 rolls out the ability to equip DHTMLX navigation components (Menu, Toolbar, Ribbon, and Sidebar) with any kind of custom content you might need to see in your apps. It’s possible to add a custom element like an image, icon, or other HTML content into the component itself or into its controls:
Custom uploader in DHTMLX RibbonUploader inside the Ribbon component. Check the sample >

The add method makes it easy to add custom content to the component – DHTMLX Ribbon in the first example above:

ribbon.data.add({
    type: "customHTML",
    html: "<div id='preloader'><div id='loader'></div></div >"
});

Meanwhile, the html property allows displaying custom content inside a control – for example, showing the uploader in the Progress button of DHTMLX Ribbon:

{
    type: "block",
    title: "Progress",
    items: [
        {
            html: "<div id='preloader'><div id='loader'></div></div >",
            size: "auto"
        }
    ]
};

Adding HTML content into controls of DHTMLX RibbonCheck the sample >

The same principle applies to other navigation components: Menu, Toolbar, and Sidebar.
Custom HTML content in DHTMLX MenuMenu items with custom icons. Check the sample >

Charts Updated

Minor enhancements have been made to some of the data visualization components: List, DataView, and Charts.
From now on, you can fine-tune your charts and equip bars and pie slices with formatted data labels via the showTextTemplate property. Thus, your bar charts can include not only values but also currency symbols (or any other symbols), for instance:
Formatted labels in DHTMLX chartsCheck the sample >

AJAX Helper

In addition to new features and improvements, DHTMLX developers have prepared the AJAX helper at the request of our clients. It works smoothly with DHTMLX components and allows them to exchange data with a web server without reloading the page. The helper makes use of the dhx.ajax object with four common methods: delete, get, post, and put.

Other Updates
Calendar API Enlarged

The Calendar component is much more developer-friendly now, as we have included a range of new events for listening to user actions (cancelClick, modeChange, monthSelected, yearSelected) as well as the getCurrentMode() method for determining what the component is currently displaying: calendar, month, year, or time picker.

Manipulating Nodes in Tree and TreeGrid

Starting with v6.3, developers can collapse and expand all nodes of DHTMLX Tree and TreeGrid at once with the help of a couple of simple methods: collapseAll and expandAll. Check the sample >

CSS Measurement Units in List and DataView

In DHTMLX List and DataView developers can set the height of items (as well as of the whole component) not only as a number but also as a string value in any CSS measurement unit: px, %, em, whatnot. For instance, define the height of the list item as 30px:

// sets the height of an item as a string value
var list = new dhx.List("list_container", {
    itemHeight:"30px"
});

We do hope our December update will contribute to the efficient development of your web apps with DHTMLX. Please leave us your feedback in the comments section below.

We invite our current clients to download the latest version in their Client’s Area.

If you’re new to the DHTMLX UI components library, feel free to download and test the trial version 6.3.

Related Materials:

The post DHTMLX Suite 6.3 Introducing Grid Keyboard Navigation, Custom HTML Content in DHTMLX Components, and AJAX Helper appeared first on DHTMLX Blog.

DHTMLX Maintenance Release: Gantt 6.3.2, Scheduler 5.3.4, Scheduler.Net 4.0.2

$
0
0

The last significant updates of 2019 have already been delivered. DHTMLX Gantt released v6.3 with decimal durations of tasks, MS Project-like link formatting, and smart rendering update. The diagramming library acquired new customization possibilities. The Suite UI library rolled out keyboard navigation in Grid and custom HTML content in data and navigation components.

However, the development of JavaScript libraries never stops. The holiday season is the right time to polish the code and bring the components to perfection. So, meet the latest maintenance releases of November and December 2019.

DHTMLX Gantt

6.3.1 (November 29, 2019)

  • (Fixed) the regression in the smart rendering, which caused links not to be rendered in some cases
  • (Fixed) the bug that allowed modifying and creating new tasks with keyboard navigation when the read-only mode is activated
  • (Fixed) the display issue with Fullscreen extension, which allowed some page elements to be displayed over the Gantt in the fullscreen mode
  • (Fixed) the bug that caused the drag-timeline extension to reset the value of the readonly config

6.3.2 (December 10, 2019)

  • (Fixed) the script error, which happened when gantt.destructor was called when the click-drag feature was enabled
  • (Fixed) gantt.parse no longer modifies data objects passed into arguments, deep copies are made instead
  • (Updated) TypeScript type definitions were updated
  • (Updated) onBeforeBranchLoading and onAfterBranchLoading public events were added, so it would be possible to modify the URL or dynamic parameters of dynamic loading requests
  • (Updated) public method for changing the URL of the dataProcessor after its initialization

Learn more in the documentation >

DHTMLX Scheduler

5.3.4 (December 10, 2019)

  • (Fixed) the incorrect work of the vertical scroll in a scrollable timeline when the mouse pointer is over the sections column
  • (Fixed) the incorrect serialization of nested objects by the dataProcessor
  • (Fixed) the script error, which fired when creating a new event using a custom lightbox

Learn more in the documentation >

DHTMLX Scheduler.Net

4.0.2 (December 10, 2019)

  • (Updated) JS part updated to catch up with the latest DHTMLX JS Scheduler version
  • (Updated) Target.net framework updated from 4.0 to 4.5.2
  • (Updated) added ColumnWidth property to C# TimelineView class

Download the latest versions of our libraries and test them free of charge for 30 days:

Current clients may find the updated packages in their Client’s Area.

The post DHTMLX Maintenance Release: Gantt 6.3.2, Scheduler 5.3.4, Scheduler.Net 4.0.2 appeared first on DHTMLX Blog.

DHTMLX Suite 6.4: Grid and List Lazy Loading, Enhanced Multiselection and Sorting, Significantly Enlarged Suite API

$
0
0

We start the year 2020 with the new release of DHTMLX UI library – Suite 6.4. The update encompasses the most sought-after features boosting the performance of all JavaScript UI components.

The highlight of the release is the lazy loading of data in Grid and List, which accelerates data processing and saves you time and resources. Among other highly demanded features delivered in v6.4 are sorting operations in Grid and TreeGrid, advanced multiselection of Grid rows and cells, ability to disable an entire form or some of its controls, deeper customization of Charts, attaching Window to a custom node, and manipulating separate tabs in Tabbar.

However, that’s not all – read more in the release article and download Suite trial version 6.4 for testing the updated components for free for 30 days!

DHTMLX Grid Updated
Grid Lazy Loading [PRO]

Our JS data table component DHTMLX Grid is reinforced with lazy loading of data, which allows steadily adding data piece by piece for rendering records in the visible area of the Grid. Such dynamic loading reduces the amount of time and resources allocated for data processing and makes it smooth and speedy.
Lazy loading is enabled via the LazyDataProxy helper:

new dhx.LazyDataProxy("https://docs.dhtmlx.com/suite/backend/lazyload", {
    limit: 30,
    prepare: 5,
    delay: 150,
    from: 0
});

The parameters of its object constructor allow you to define the URL where data should be loaded and some other optional settings such as a limit of records and delay time for dynamic loading. Learn more about dynamic loading in Grid >

After the LazyDataProxy initialization, you only have to call the load method and pass the lazyDataProxy as a parameter:

var grid = new dhx.Grid("grid_container");
grid.data.load(lazyDataProxy);

Check the sample >
Now, you’ll be all set for efficient data processing with DHTMLX Grid!

Multiselection of Grid Cells and Rows

DHTMLX Grid Multiselection
V6.4 introduces the ability to select multiple cells and rows in DHTMLX Grid. Using Ctrl and Shift shortcuts, end users can select random cells and rows situated in any order or an entire range of cells or rows.

For example, that’s how we turn on the multiselection of rows by setting the multiselection property to true and specifying the selection property to “row”:

var grid = new dhx.Grid("grid_container", {
    columns: [// columns config],
    multiselection:true,
    selection:"row",
    data: dataset
});

Row Multiselection in DHTMLX GridCheck the sample >

Besides the ability to switch on the multiselection functionality for end users, developers can manipulate the selection of Grid cells and rows on their own via the API.

The setCell() method allows defining which cells to select. Here we set up the the multiselection of one cell in the Yearly Change column and two cells in the Net Change column. By specifying the ctrlUp: true and shiftUp: false parameters we determine that it’s possible to select only separate cells, not ranges:

grid.selection.setCell(grid.data.getId(0),"yearlyChange");
grid.selection.setCell(grid.data.getId(1),"netChange", true, false);
grid.selection.setCell(grid.data.getId(3),"netChange", true, false);

Сell multiselection in DHTMLX Grid

Grid and TreeGrid Updated
Sorting Operations

From now on, you are free to choose which columns should be sortable in DHTMLX Grid and TreeGrid. In order to enable sorting of particular columns you need to specify the sortable: true property in their configuration while setting sortable: false in the configuration of Grid (or TreeGrid) to disable sorting in the rest of columns.

In the example below only the columns with countries and density can be sorted:

var grid = new dhx.Grid("grid_container", {
    columns: [
        { width: 200, id: "country", header: [{ text: "Country" }], sortable: true },
        { width: 150, id: "land", header: [{ text: "Land" }] },
        { width: 150, id: "density", header: [{ text: "Density" }], sortable: true }
    ],
    data: dataset,
    sortable: false,    
});

Sorting columns in DHTMLX GridCheck the sample >

Additionally, the new getSortingState method gives you an opportunity to receive the id of the column, by which Grid (or TreeGrid) is sorted, as well as the order of sorting (ascending or descending).

Adjusting Columns’ Width

Both Grid and TreeGrid obtain a new ability to adjust the width of their columns to the size of the entire table using the autoWidth configuration option:

var grid = new dhx.Grid("grid_container", {
    columns: [// columns config],
    autoWidth:true,
    data: dataset
});

If needed, it’s possible to change the width of a specific column to match the size of its content automatically with the help of the adjust property:

var grid = new dhx.Grid("grid_container", {
    columns: [
        { id: "country", header: [{ text: "Country" }], adjust: "data" },
        { id: "population", header: [{ text: "Population" }] }
    ],
    adjust: false,
    data: dataset
});

As shown in the data table below, the width of all columns is adjusted to the width of Grid, however, the first column matches the width of its content:
Adjusting columns' width in DHTMLX GridCheck the sample >

In addition to the new functionality described above, now DHTMLX Grid and TreeGrid components allow developers to verify if a column is displayed or hidden via the isColumnHidden method. Grid keyboard shortcuts are also enlarged with new combinations for navigating Grid cells and changing the selection of cells simultaneously:

DHTMLX Grid keyboard navigationCheck the sample >

Charts Updated

Our appealing JS charting library acquires more flexibility in v6.4. New features include the ability to rotate scale labels and data labels inside bar and X-bar and use up to four axes (two vertical and two horizontal).

Rotate scale labels in DHTMLX chartsCheck the sample >

Rotate data labels in DHTMLX bar chartsCheck the sample >

Apart from that, we added a new event for tracking clicks on data series serieClick.

Form Updated

Starting with v6.4, developers can disable an entire form or its elements, so that end users won’t be able to interact with them. For that purpose, you just need to add the disabled: true property in the configuration of the form:

var form = new dhx.Form("form_container", {
    css: "dhx_widget--bordered",
    disabled: true
});

For instance, in order to disable a button control of the form, you need to apply the disable() method of the object returned by the getItem() method:

form.getItem("button_id").disable();

DHTMLX Form control disabledCheck the sample >

Tabbar Updated

Now working with DHTMLX tabbar becomes more convenient, as a new range of methods lets developers manipulate not only the entire tab bar but also separate tabs. For instance, here is how we can disable one of the tabs in DHTMLX Tabbar with the help of the disableTab() method:

tabbar.disableTab("London");
// -> true|false

DHTMLX tabbarCheck the sample >

Following the same logic, you can equip particular tabs with the close button by specifying the ids of the chosen tabs in the closable property:

var tabbar = new dhx.Tabbar("tabbar", {
    closable: ["paris", "london"]
});
Window Updated

The release brings out the ability to attach DHTMLX window to a custom node instead of the body of the page. It’s possible due to the node property, where you can specify the container for your window:

var dhxWindow = new dhx.Window({
    node:"customDiv"
});

Check the sample >

Other Updates

In the release article, we’ve described the most-awaited features of the Suite UI library 6.4. However, the update rolled out many other useful improvements:

  • Calendar and TimePicker: the new clear method
  • ColorPicker: the ability to specify the palette or picker mode of the component; the clear method
  • ComboBox: data object; specifying the label position; events updated
  • DataView: events and multiselection updated
  • Layout: expanding and collapsing Layout cells; events and methods updated
  • List: lazy loading
  • Menu, Ribbon, Sidebar, Toolbar: checking if an item is disabled; methods and events updated
  • Tree: new events

You can get acquainted with the full list of updates 6.4 in the documentation.

Try out all the new features – download the DHTMLX Suite 6.4 trial version (free for 30 days).

We invite our current clients to get the latest version of our UI library in their Client’s Area.

Looking forward to your feedback!

Related Materials:

The post DHTMLX Suite 6.4: Grid and List Lazy Loading, Enhanced Multiselection and Sorting, Significantly Enlarged Suite API appeared first on DHTMLX Blog.


How to Use DHTMLX Gantt with Vue.js Framework [Demo]

$
0
0

Firstly published on May 11, 2017. Updated on January 30, 2020

What’s extremely awesome about our Gantt Chart library (besides fast performance and vast variety of features) is that it allows integrations with almost all new and popular frameworks and technologies. And today we’ll show you the easiest way to use js gantt chart with Vue.js, progressive JavaScript framework.

So, follow the instructions below to create a Vue.js Gantt chart or jump to a complete demo on GitHub right away.

New to dhtmlxGantt? Learn more about the library now

How We Start

The first thing we need to do is to get an app skeleton. And for this, we’re going to use vue-cli. If you don’t have one, you can get it with the node package manager using command (npm install -g @vue/cli). See this article.

To create an app, run the following command:

vue create gantt-vue

It will request some project info. You can just leave default answers and press the enter button for each question or select functions manually.

Then you need to go to the app directory, install dependencies and run it.

cd gantt-vue

If you use yarn, you need to call the following commands:

yarn install
yarn serve

If you use npm, you need to call the following commands:

npm install
npm run dev

After these steps, the app should run on http://localhost:8080

vuejs-install

Moving to Gantt Chart Part

Now we should get the dhtmlxGantt code. To do so, run the following command:

yarn add dhtmlx-gantt --save (for yarn)
npm install dhtmlx-gantt --save (for npm)

Then, to add a Gantt chart to an application, we should create a component.

So, we’ll start by creating a folder for the app components. Open the src folder and create components folder in it. Then, create Gantt.vue file in the components folder and put the following code into it:

{{ src/components/Gantt.vue }}
<template>
  <div ref="gantt"></div>
</template>
 
<script>
import 'dhtmlx-gantt'
export default {
  name: 'gantt',
  props: {
    tasks: {
      type: Object,
      default () {
        return {data: [], links: []}
      }
    }
  },
 
  mounted: function () {
    gantt.config.xml_date = "%Y-%m-%d";
 
    gantt.init(this.$refs.gantt);
    gantt.parse(this.$props.tasks);
  }
}
</script>
 
<style>
    @import "~dhtmlx-gantt/codebase/dhtmlxgantt.css";
</style>

Now, the Gantt chart component is ready. When the element will be added to the page it will initialize the Gantt chart under “gantt” ref. Then, Gantt chart will load data from the tasks property.

And now it’s time to add the component to our app.

Open App.vue and add the following code instead of the one we’ve already had there.

{{ src/App.vue }}
<template>
  <div class="container">
    <gantt class="left-container" :tasks="tasks"></gantt>
  </div>
</template>
 
<script>
import Gantt from './components/Gantt.vue';
 
export default {
  name: 'app',
  components: {Gantt},
  data () {
    return {
      tasks: {
        data: [
          {id: 1, text: 'Task #1', start_date: '2020-01-17', duration: 3, progress: 0.6},
          {id: 2, text: 'Task #2', start_date: '2020-01-20', duration: 3, progress: 0.4}
        ],
        links: [
          {id: 1, source: 1, target: 2, type: '0'}
        ]
      },
    }
  }
}
</script>

Now, we should see the Gantt chart with predefined tasks on a page.

gantt-vue

Listening changes and handling events

Let’s say we need to trace changes in Gantt made by the user and process them somehow – show the details of the selected item in a separate form, keep data model of the parent component up to date, or send these changes to the backend. In other words, we need a way to let the rest of the app know what happens inside Gantt.

To do so we can create a DataProcessor with a custom router object, where the router is a function and $emit DataProcessor events to the parent component.

As a simple demonstration, let’s implement a ‘changelog’ feature – we’ll write all changes made in Gantt in a neat list somewhere on the page.

Firstly, go into the Gantt component and add code that will trace and emit changes of dhtmlxGantt. Add the following code right after the gantt.init call:

   {{ src/components/Gantt.vue }}  
gantt.createDataProcessor((entity, action, data, id) => {
      this.$emit(`${entity}-updated`, id, action, data);
   });

It adds handlers to the add/update/delete events for the links and tasks. If some particular handler is called, it will trigger vue event on our component with parameters.

The next step is to add listeners for these events into the app component and write a log of actions in another div.

Let’s extend the app component with the required functionality:

{{ src/App.vue }}
import Gantt from './components/Gantt.vue';
 
export default {
  name: 'app',
  components: {Gantt},
  data () {
    return {
      tasks: {
        data: [
          {id: 1, text: 'Task #1', start_date: '2020-01-17', duration: 3, progress: 0.6},
          {id: 2, text: 'Task #2', start_date: '2020-01-20', duration: 3, progress: 0.4}
        ],
        links: [
          {id: 1, source: 1, target: 2, type: '0'}
        ]
      }
    }
  },
  methods: {
    addMessage (message) {
      this.messages.unshift(message)
      if (this.messages.length > 40) {
        this.messages.pop()
      }
    },
 
    logTaskUpdate (id, mode, task) {
      let text = (task && task.text ? ` (${task.text})`: '')
      let message = `Task ${mode}: ${id} ${text}`
      this.addMessage(message)
    },
 
    logLinkUpdate (id, mode, link) {
      let message = `Link ${mode}: ${id}`
      if (link) {
        message += ` ( source: ${link.source}, target: ${link.target} )`
      }
      this.addMessage(message)
    }
  }
}

What you can see here – we’ve added an array property where we’re going to store log entries, a method that adds a new message to the top of that array (our log will show new entries first). Also, we’ve added two more methods that will create log messages for actions done with tasks and links and add them to the message stack.

And finally, update a template of the app component to utilize these functions:

{{ src/App.vue }}
<template>
  <div class="container">
    <div class="right-container">
      <ul class="gantt-messages">
        <li class="gantt-message" v-for="message in messages">{{message}}</li>
      </ul>
    </div>
    <gantt class="left-container" :tasks="tasks" @task-updated="logTaskUpdate" @link-updated="logLinkUpdate"></gantt>
  </div>
</template>

We’ve added a simple two-column layout, attached our log handlers to the Gantt events that we emit from the Gantt module, added a container for log messages and bound them to our log messages stack.

Now, if we make some changes to Gantt, messages should be shown on the right side.

vuejs-gantt-chart

If you want to display some info about the selected tasks, proceed to the instructions below.

To show information about selected tasks, we can capture API events of DHTMLX Gantt (‘onTaskSelected‘) and $emit them to the parent component. We can also use the ‘onTaskIdChange‘ event to update information after changing the task id.

Open the Gantt chart component and add the following code right before gantt.init call:

{{ src/components/Gantt.vue }}      
gantt.attachEvent('onTaskSelected', (id) => {
      let task = gantt.getTask(id);
      this.$emit('task-selected', task);
});
 
    gantt.attachEvent('onTaskIdChange', (id, new_id) => {
       if (gantt.getSelectedId() == new_id) {
         let task = gantt.getTask(new_id);
         this.$emit('task-selected', task);
        }
     });

Here we’ve added the onTaskSelected handler that is going to trigger a ‘task-selected’ event.

Open the app component to add a selection handler to it. We need to add some necessary elements to our template as well. It should look like this:

{{ src/App.vue }}
<template>
  <div class="container">
    <div class="right-container">
      <div class="gantt-selected-info">
        <div v-if="selectedTask">
          <h2>{{selectedTask.text}}</h2>
          <span><b>ID: </b>{{selectedTask.id}}</span><br/>
          <span><b>Progress: </b>{{selectedTask.progress|toPercent}}%</span><br/>
          <span><b>Start Date: </b>{{selectedTask.start_date|niceDate}}</span><br/>
          <span><b>End Date: </b>{{selectedTask.end_date|niceDate}}</span><br/>
        </div>
        <div v-else class="select-task-prompt">
          <h2>Click any task</h2>
        </div>
      </div>
      <ul class="gantt-messages">
        <li class="gantt-message" v-for="message in messages">{{message}}</li>
      </ul>
    </div>
    <gantt class="left-container" :tasks="tasks" @task-updated="logTaskUpdate" @link-updated="logLinkUpdate" @task-selected="selectTask"></gantt>
  </div>
</template>

Here we’ve added another container, which is bound to the selectedTask property of the app component using “v-if” directive. Besides, we’ve added a handler for the “task-selected” event we now emit.

Make sure to add this property to the app component:

   {{ src/App.vue }}    
   selectedTask: null

And add the selectTask method, which is used in the handler we’ve defined above:

    {{ src/App.vue }}    
    selectTask: function(task){
      this.selectedTask = task
    }

Thus, each time a user selects a task inside Gantt, the component emits the ‘task-selected’ event. Then this event is captured by the app component. Inside the event handler, we update the selectedTask property, which in its turn invokes a repaint of the .gantt-selected-info element with task details.

Note that the task object has the start_date/end_date properties of Date type and progress completion in float type – these should be formatted in a human-friendly form before being added to the page.

It’s implemented using toPercent and niceDate filters, which we define like this:

{{ src/App.vue }}  
filters: {
    toPercent (val) {
      if(!val) return '0'
      return Math.round((+val) * 100)
    },
    niceDate (obj){
      return '${obj.getFullYear()} / ${obj.getMonth()} / ${obj.getDate()}'
    }
  }

Now, if we run our app and select a task, we should see that its info is shown on the right.

Gantt-chart-vuejs

So, we’ve created a simple Gantt chart with the help of DHTMLX Gantt and Vue.js. The results of our work can be found on GitHub. If you follow the instructions above and meet any difficulties, don’t hesitate to share them with us.

Which technologies/frameworks are you using?

We need your feedback to provide the right integrations at the right time. Please leave your requests here:

Thank you in advance and stay tuned for new tutorials!

The post How to Use DHTMLX Gantt with Vue.js Framework [Demo] appeared first on DHTMLX Blog.

How to Use DHTMLX Scheduler with Vue.js Framework [Demo]

$
0
0

Great news for Vue.js lovers! Our dev team prepared a thorough guide on how to integrate our high-performing JS event calendar component – DHTMLX Scheduler – with the progressive JavaScript framework Vue.js.

So, below is a step-by-step tutorial for creating a Vue Scheduler component with code snippets and illustrations. You can also kick-start the development process with a complete demo on GitHub.

New to DHTMLX Scheduler? Learn more about the library now >

1. How to Start

Firstly, we need to create an app skeleton. For this purpose, we’re going to use vue-cli. If you don’t have one, you can easily install it with the node package manager using command (npm install -g @vue/cli). Check this article >

In order to use yarn in a project, it must be installed globally in the system (npm install -g yarn).

So, let’s run the next command to create an app:

vue create scheduler-vue

It will request you to provide project information. You can choose to leave the default answers and press Enter for each question or select functions manually.

The next step is to go to the app directory, install dependencies and run your Vue.js app:

cd scheduler-vue

For using yarn call:

yarn install
yarn serve

For using npm call:

npm install
npm run dev

Here we go – your app now runs on: http://localhost:8080

vuejs-install

2. Moving to Scheduler Part

At this point, we need to get the code of DHTMLX Scheduler – let’s run the command:

yarn add dhtmlx-scheduler --save (for yarn)
npm install dhtmlx-scheduler --save (for npm)

As we want to add DHTMLX Scheduler to our app, we have to create a component. Firstly, we’ll create a folder for the app components – open the src folder and create the components folder in it. After that, create Scheduler.vue file in the components folder and add the next lines of code into it:

{{ src/components/Scheduler.vue }}
<template>
  <div ref="scheduler"></div>
</template>
 
<script>
import 'dhtmlx-scheduler'
export default {
  name: 'scheduler',
  props: {
    events: {
      type: Array,
      default () {
        return {events: []}
      }
    }
  },
 
  mounted: function () {
    scheduler.skin = "material";
    scheduler.config.header = [
        "day",
        "week",
        "month",
        "date",
        "prev",
        "today",
        "next"
    ];
 
    scheduler.init(this.$refs.scheduler, new Date(2020, 0, 20), "week");
    scheduler.parse(this.$props.events);
  }
}
</script>
 
<style>
    @import "~dhtmlx-scheduler/codebase/dhtmlxscheduler_material.css";
</style>

Congrats! We’re done with the Scheduler component. When the element will be added to the page, it will initialize Scheduler under “scheduler” ref. Afterward, Scheduler will load data from the events property.

Right now we need to finally add the component to our Vue.js application. Open App.vue and replace the code we’ve already had there with the next lines:

{{ src/App.vue }}
<template>
  <div class="container">
    <scheduler class="left-container" :events="events"></scheduler>
  </div>
</template>
 
<script>
import Scheduler from './components/Scheduler.vue';
 
export default {
  name: 'app',
  components: {Scheduler},
  data () {
    return {
      events: [
        { id:1, start_date:"2020-01-20 6:00", end_date:"2020-01-20 15:00", text:"Event 1"},
        { id:2, start_date:"2020-01-23 6:00", end_date:"2020-01-23 20:00", text:"Event 2"}
      ]
    }
  }
}
</script>
 
<style>
  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
  }
 
  .container {
    height: 100%;
    width: 100%;
  }
 
  .left-container {
    overflow: hidden;
    position: relative;
    height: 100vh;
  }
 
</style>

Once you are done, you will see DHTMLX Scheduler with predefined events on the page looking like that:

Basic Vue Scheduler component

3. Listening to changes and handling events

Suppose we need to track and process changes made by users in our Scheduler – for example, show details of selected events in a separate form, update the data model of the parent component or send these changes to the backend. Simply put, we need our app to be aware of what’s going on inside Scheduler.

For that purpose, we can capture API events of DHTMLX Scheduler and $emit them to the parent component.

To make it clearer, let’s see how to create a simple changelog noting down all the changes made in Scheduler in a neat list on the right side of the page.

At first, you should go into the Scheduler component and place the code that will trace and emit Scheduler changes just before calling scheduler.init:

  {{ src/components/Scheduler.vue }}  
        scheduler.attachEvent("onEventAdded", (id, ev) => {
            this.$emit("event-updated", id, "inserted", ev);
        });
        scheduler.attachEvent("onEventChanged", (id, ev) => {
            this.$emit("event-updated", id, "updated", ev);
        });
        scheduler.attachEvent("onEventDeleted", (id, ev) => {
            this.$emit("event-updated", id, "deleted");
        });

What this code does is add handlers to the create/update/delete events of DHTMLX Scheduler. If some particular handler is called, it will trigger the Vue event on our component with parameters.

Secondly, you need to attach event listeners to the app component and write a log of actions in another div. Let’s do it this way:

{{ src/App.vue }}
<script>
import Scheduler from './components/Scheduler.vue';
 
export default {
  name: 'app',
  components: {Scheduler},
  data () {
    return {
      events: [
        { id:1, start_date:"2020-01-20 6:00", end_date:"2020-01-20 15:00", text:"Event 1"},
        { id:2, start_date:"2020-01-23 6:00", end_date:"2020-01-23 20:00", text:"Event 2"}
      ],
      messages: []
    }
  },
  methods: {
    addMessage (message) {
      this.messages.unshift(message)
      if (this.messages.length > 40) {
        this.messages.pop()
      }
    },
 
    logEventUpdate (id, mode, ev) {
      let text = (ev && ev.text ? ` (${ev.text})`: '')
      let message = `Event ${mode}: ${id} ${text}`
      this.addMessage(message)
    },
  }
}
</script>
 
<style>
  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
  }
 
  .container {
    height: 100%;
    width: 100%;
  }
 
  .left-container {
    overflow: hidden;
    position: relative;
    height: 100vh;
    display: inline-block;
    width: 82vw;
  }
 
  .right-container {
    border-right: 1px solid #cecece;
    float: right;
    height: 100%;
    width: 340px;
    box-shadow: 0 0 5px 2px #aaa;
    position: relative;
    z-index:2;
  }
 
.scheduler-messages {
    list-style-type: none;
    height: 50%;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-left: 5px;
  }
 
  .scheduler-messages > .scheduler-message {
    background-color: #f4f4f4;
    box-shadow:inset 5px 0 #d69000;
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 14px;
    margin: 5px 0;
    padding: 8px 0 8px 10px;
  }
</style>

With this code we have equipped our app component with:

  • the array property for storing log entries;
  • method for adding a new message on top of our array so that new entries can be displayed first in our log;
  • two more methods for creating log messages for the actions performed with tasks and links and for adding them to the message stack.

All what’s left to do now is update the template of the app component to apply these functions:

{{ src/App.vue }}
<template>
  <div class="container">
    <scheduler class="left-container" :events="events" @event-updated="logEventUpdate"></scheduler>
    <div class="right-container">
      <ul class="scheduler-messages">
        <li class="scheduler-message" v-for="message in messages">{{message}}</li>
      </ul>
    </div>
  </div>
</template>

There you are!

Summing up our step-by-step guide, here we’ve created a simple two-column layout of DHTMLX Scheduler, attached our log handlers to the Scheduler events that we emit from the Scheduler module, added a container for log messages and bound them to our log messages stack.

Just to check everything works fine, try to make some changes to DHTMLX Scheduler – messages should be displayed on the right side:
Event listeners in Vue Scheduler component

These were three steps for creating a simple Vue Event/Booking Calendar with DHTMLX. The demo application can be found in our GitHub repository.

If you follow the instructions above and face any difficulties, share them with us!

What Else You Can Do:

The post How to Use DHTMLX Scheduler with Vue.js Framework [Demo] appeared first on DHTMLX Blog.

DHTMLX Maintenance Release: Gantt 6.3.7, Scheduler 5.3.5, Suite 6.4.1, Diagram 2.2.1, and Pivot 1.4.1

$
0
0

Kick-start your web app development with our sophisticated JavaScript libraries and catch up with the recent updates of all our major components in 2020: Gantt chart, Scheduler, Suite UI library, Diagram library, Pivot table, and Rich Text Editor.

Here is a list of the latest maintenance updates delivered by our dev team:

DHTMLX Gantt 6.3.4 – 6.3.7

6.3.4 (December 27, 2019)

  • (Fixed) crashes of the resource load diagram when smart rendering is switched off
  • (Fixed) the issue with the custom task property named “unit”, as Gantt considered it as a duration unit value and multiplied the task duration after its dragging
  • (Fixed) the incorrect Tooltip position when the autosize config is enabled
  • (Fixed) the incorrect alignment behavior of grid cells when both the scrollable property and autofit config are set to true
  • (Fixed) the issue with the auto-scheduling extension that caused Gantt to freeze when a task has the constraint type (SNET/FNET/SNLT/FNLT) with no date specified, or with an invalid date
  • (Updated) creating a link between a task in the timeline and a placeholder in the grid is now blocked

6.3.5 (January 31, 2020)

  • (Fixed) the issue with task grouping, which caused vertical scroll position to reset after moving any task with drag and drop
  • (Fixed) the script error, which happened when drag_timeline config was set to null
  • (Fixed) the incorrect position of highlighted cells when static_background and static_background_cells are enabled and smart_rendering is disabled
  • (Fixed) the issue with the onAfterBranchLoading event not being called
  • (Fixed) the incorrect work of the smart rendering when the value of task_height is less than the value of row_height

6.3.6 (February 10, 2020)

  • (Fixed) the regression in gantt.resetLayout, which caused the script error
  • (Fixed) the issue with the QuickInfo popup, which caused it to be positioned behind the resource panel in some cases
  • (Fixed) the script error thrown from the gantt.getShortcutHandler method
  • (Fixed) the script error thrown from the tooltip.show(x, y) method gantt.getTaskNode now returns the correct HTML element for split tasks
  • (Fixed) the issue with horizontal scrollbars not being displayed when visibility groups are specified in some layout configurations

6.3.7 (February 12, 2020)

  • Significant performance improvement for the smart rendering of chart and resource panel

The v6.3.7 has made a substantial difference in the speed and performance of the DHTMLX Gantt chart, especially with the resource panel.


You can check it out yourself using the following snippets:
Previous versions: https://snippet.dhtmlx.com/5/1b0d9c4ec
The new version 6.3.7: https://snippet.dhtmlx.com/5/87e1c4df3

Learn more in the documentation >

Suite 6.4.1

6.4.1 (January 30, 2020)

  • (Fixed) the behavior of Lazy loading in Grid
  • (Fixed) the issue with the template configuration option in a column of Grid
  • (Fixed) the issue with the headerIcon property of a layout cell
  • (Fixed) the issue with the height of layout cells when the layout has a header

Besides, in February we updated the demo of Suite UI components with React on GitHub.

Learn more in the documentation >

DHTMLX Scheduler 5.3.5

5.3.5 (January 31, 2020)

  • (Fixed) styling of the ‘next’ button on the right side of the navigation panel in Terrace skin when the scheduler is initialized using header config
  • (Fixed) the incorrect work of the URL extension, which failed to highlight events by URL in some cases
  • (Fixed) the incorrect work of the Material skin when scheduler styles are loaded using the @import command
  • (Updated) If neither header config nor default markup is specified while initializing the scheduler, a default value for the scheduler header will be auto-generated to escape a script error

Learn more in the documentation >

Rich Text Editor 1.1.2

1.1.2 (February 13, 2020)

  • (Fixed) Issues with interaction between the HTML form and controls of Toolbar

Learn more in the documentation >

Pivot 1.4.1

1.4.1 (January 15, 2020)

  • (Fixed) the issue with attaching Pivot to the Layout (Suite UI component)

Learn more in the documentation >

Diagram 2.2.1

2.2.1 (December 30, 2019)

  • (Fixed) the issue with IE support for the image loader in Diagram editor

Learn more in the documentation >

Download the latest versions of our libraries and test them free of charge for 30 days:

Current clients may find the updated packages in their Client’s Area.

The post DHTMLX Maintenance Release: Gantt 6.3.7, Scheduler 5.3.5, Suite 6.4.1, Diagram 2.2.1, and Pivot 1.4.1 appeared first on DHTMLX Blog.

How to Use DHTMLX Scheduler Component with React JS Library [Demo]

$
0
0

We continue a series of tutorials devoted to the integration of our web app components with different client-side frameworks. Meet our new step-by-step guide on using DHTMLX Scheduler with the popular React JS component-based library.

Here you will learn how to:

  • create a basic React Scheduling application
  • extend the event calendar functionality with custom features
  • make it listen and react to user actions in real time

Before diving deeper into the subject, we invite you to check a complete demo on our React Scheduler GitHub repository.

How to Start

Our first step is to initialize the application structure. For this, we will use the Create React app tool. You can find additional information about it in this article.

To create an app run the following command:

npx create-react-app scheduler-react

Then we go to the app folder and run the application with the following command:

cd scheduler-react
yarn start (if you use yarn)
npm start (if you use npm)

Now our application should start on http://localhost:3000/

React app

Adding DHTMLX Scheduler to React App

Let’s start with our Scheduler component.
The first thing you need is to add the DHTMLX Scheduler package to your project.
A free version of it can be added via npm or yarn:

yarn add dhtmlx-scheduler (for yarn)
or
npm install dhtmlx-scheduler (for npm)

Then, create the src/components/Scheduler folder. Here we’ll add a React Component wrapper for DHTMLX Scheduler.
Create the Scheduler.js file and open it:

{{ src/components/Scheduler/Scheduler.js }}
import React, { Component } from 'react';
import 'dhtmlx-scheduler';
import 'dhtmlx-scheduler/codebase/dhtmlxscheduler_material.css';
 
const scheduler = window.scheduler;
 
export default class Scheduler extends Component {
    componentDidMount() {
        scheduler.skin = 'material';
        scheduler.config.header = [
            'day',
            'week',
            'month',
            'date',
            'prev',
            'today',
            'next'
        ];
 
        const { events } = this.props;
        scheduler.init(this.schedulerContainer, new Date(2020, 5, 10));
        scheduler.clearAll();
        scheduler.parse(events);
    }
 
    render() {
        return (
            <div
                ref={ (input) => { this.schedulerContainer = input } }
                style={ { width: '100%', height: '100%' } }
            ></div>
       );
    }
}

Now create the Scheduler.css file and add styles for the scheduler-container:

{{ src/components/Scheduler/Scheduler.css }}
.scheduler-container {
    height: 100vh;
    width: 100vw;
}

And finally, create the index.js file with the following content:

{{ src/components/Scheduler/index.js }}
import Scheduler from './Scheduler';
import './Scheduler.css';
export default Scheduler;

As DHTMLX Scheduler is a regular JS library that lives outside of the ReactJS world, we created a wrapper component. Once our component is mounted, we initialize DHTMLX Scheduler and attach it to DOM. We can also populate it with the data passed via props.

Note that since a free version of DHTMLX Scheduler has no destructor, we do not define the componentWillUnmount. That also means that if we remove a component from React at some point, the instance of DHTMLX Scheduler will stay in memory and will be reused the next time when the component is mounted again.

Now let’s add Scheduler to our App component. Note that we use hard-coded data for this sample:

{{ src/App.js }}
import React, { Component } from 'react';
import Scheduler from './components/Scheduler';
import './App.css';
 
const data = [
    { start_date:'2020-06-10 6:00', end_date:'2020-06-10 8:00', text:'Event 1', id: 1 },
    { start_date:'2020-06-13 10:00', end_date:'2020-06-13 18:00', text:'Event 2', id: 2 }
];
 
class App extends Component {
    render() {
        return (
            <div>
                <div className='scheduler-container'>
                    <Scheduler events={data}/>
                </div>
            </div>
        );
    }
 }
 export default App;

If we run the app now, we should see a simple event calendar with initial events on a page:

yarn start
or
npm start

Basic React Scheduler

Configuring React Scheduler Component

Let’s add some custom functionality to our React js event calendar. Suppose we need to add a toolbar with a checkbox that will be responsible for switching the time format on the hour scale.

We can change the time format using the hour_date config and the hour_scale template. After that, we need to redraw the view with a new format using a render. Let’s try to implement it in React. Firstly, let’s go to the Scheduler component and implement a couple of presets for the view configuration.

Open Scheduler.js to add the following code to it:

{{ src/components/Scheduler/Scheduler.js }}
   componentDidMount() {
        scheduler.skin = 'material';
        scheduler.config.header = [
            'day',
            'week',
            'month',
            'date',
            'prev',
            'today',
            'next'
        ];
        scheduler.config.hour_date = '%g:%i %A';
        scheduler.xy.scale_width = 70;
 
        const { events } = this.props;
        scheduler.init(this.schedulerContainer, new Date(2020, 5, 10));
        scheduler.clearAll();
        scheduler.parse(events);
    }
    shouldComponentUpdate(nextProps) {
        return this.props.timeFormatState !== nextProps.timeFormatState;
    }
 
    componentDidUpdate() {
        scheduler.render();
    }
 
    setTimeFormat(state) {
        scheduler.config.hour_date = state ? '%H:%i' : '%g:%i %A';
        scheduler.templates.hour_scale = scheduler.date.date_to_str(scheduler.config.hour_date);
    }

Here we added the componentDidUpdate handler, which will repaint the view on updates, and the shouldComponentUpdate handler, where we will determine if we need to update the view.
And add a call to the setTimeFormat function at the beginning of the render method:

{{ src/components/Scheduler/Scheduler.js }}
      render() {
        const { timeFormatState } = this.props;
        this.setTimeFormat(timeFormatState);
        return (
            <div
                ref={ (input) => { this.schedulerContainer = input } }
                style={ { width: '100%', height: '100%' } }
            ></div>
        );
    }

Now Scheduler displays the time in the 24 hour format. When the hour_date property and the hour_scale template change, we need to invoke the update of the view.

Let’s add UI for changing the time format. We’ll do with a simple toolbar and switcher.
Create the Toolbar component:

{{ src/components/Toolbar/index.js }}
import Toolbar from './Toolbar';
import './Toolbar.css';
export default Toolbar;
{{ src/components/Toolbar/Toolbar.js }}
import React, { Component } from 'react';
export default class Toolbar extends Component {
    handleTimeFormatStateChange = (e) => {
        if (this.props.onTimeFormatStateChange) {
            this.props.onTimeFormatStateChange(e.target.checked)
        }
    }
    render() {
        return (
            <div className='time-format-section'>
                <label className='time-format-chkbx'>
                    Time format:
                    <input type='checkbox'
                        checked={ this.props.timeFormatState }
                        onChange={ this.handleTimeFormatStateChange }
                    />
                    <div className='chkbx-text'></div>
                </label>
            </div>
        );
    }
}
{{ src/components/Toolbar/Toolbar.css }}
.tool-bar {
    background: #ededed;
    height: 40px;
    line-height: 14px;
    padding: 5px 10px;
    text-align: center;
    padding-left: 60px;
}
 
.time-format-chkbx {
    display: inline-flex;
    padding-top: 10px;
    font-family: Roboto,Arial;
    user-select: none;
    font-weight: 500;
    font-size: 20px;
    color: rgba(0,0,0,.75);
}
 
.time-format-chkbx input {
    position: absolute;
    z-index: -1;
    opacity: 0;
    margin: 10px 0 0 20px;
}
.chkbx-text {
    position: relative;
    cursor: pointer;
    user-select: none;
    font-weight: 800;
    font-size: 20px;
    line-height: 30px;
    font-family: Roboto,Arial;
    margin-left: 10px;
}
.chkbx-text:before {
    content: '12h';
    text-align: right;
    padding: 0 10px;
    position: absolute;
    top: -8px;
    left: 0;
    width: 60px;
    height: 30px;
    border-radius: 15px;
    background: #CDD1DA;
    box-shadow: inset 0 2px 3px rgba(0,0,0,.2);
    transition: .2s;
}
.chkbx-text:after {
    content: '';
    position: absolute;
    top: -6px;
    left: 2px;
    width: 25px;
    height: 25px;
    border-radius: 15px;
    background: #FFF;
    box-shadow: 0 2px 5px rgba(0,0,0,.3);
    transition: .2s;
}
.time-format-chkbx input:checked + .chkbx-text:before {
    content: '24h';
    color: white;
    text-align: left;
    background: #0288d1;
}
.time-format-chkbx input:checked + .chkbx-text:after {
    left: 53px;
}
.time-format-chkbx input:focus + .chkbx-text:before {
    box-shadow: inset 0 2px 3px rgba(0,0,0,.2), 0 0 0 3px rgba(2,136,209,.7);
}

And update the height of the scheduler-container:

{{ src/components/Scheduler/Scheduler.css }}
.scheduler-container {
    height: calc(100vh - 50px);
    width: 100vw;
}

Here we add the checkbox for changing the time format and provide the onTimeFormatStateChange handler for a parent component. Now you need to add the toolbar to the App component:

{{ src/App.js }}
import Toolbar from './components/Toolbar';

and a handler for changing the event:

{{ src/App.js }}
  state = {
        currentTimeFormatState: true
    };
 
    handleTimeFormatStateChange = (state) => {
        this.setState({
            currentTimeFormatState: state
        });
    }

JSX:

{{ src/App.js }}
  render() {
        const { currentTimeFormatState } = this.state;
        return (
            <div>
                <div className="tool-bar">
                    <Toolbar
                        timeFormatState={currentTimeFormatState}
                        onTimeFormatStateChange={this.handleTimeFormatStateChange}
                    />
                </div>
                <div className='scheduler-container'>
                    <Scheduler
                        events={data}
                        timeFormatState={currentTimeFormatState}
                    />
                </div>
            </div>
        );
    }

So, as a result, we get the opportunity to pass the updated state to our React Scheduler every time the user changes the time format:

React Scheduler with Toolbar

Processing Changes Made in DHTMLX React Scheduler

Now we’ll show how to capture calendar view changes and then pass them somewhere in the app.
We’ll capture Scheduler changes using the dhtmlxScheduler events.
Let’s see how this is done in practice. Open src/components/Scheduler/Scheduler.js and add the following method:

{{ src/components/Scheduler/Scheduler.js }}
 initSchedulerEvents() {
        if (scheduler._$initialized) {
            return;
        }
 
        const onDataUpdated = this.props.onDataUpdated;
 
        scheduler.attachEvent('onEventAdded', (id, ev) => {
            if (onDataUpdated) {
                onDataUpdated('create', ev, id);
            }
        });
 
        scheduler.attachEvent('onEventChanged', (id, ev) => {
            if (onDataUpdated) {
                onDataUpdated('update', ev, id);
            }
        });
 
        scheduler.attachEvent('onEventDeleted', (id, ev) => {
            if (onDataUpdated) {
                onDataUpdated('delete', ev, id);
            }
        });
        scheduler._$initialized = true;
  }
     componentDidMount() {
        scheduler.skin = 'material';
        scheduler.config.header = [
            'day',
            'week',
            'month',
            'date',
            'prev',
            'today',
            'next'
        ];
        scheduler.config.hour_date = '%g:%i %A';
        scheduler.xy.scale_width = 70;
 
        this.initSchedulerEvents();
 
        const { events } = this.props;
        scheduler.init(this.schedulerContainer, new Date(2020, 5, 10));
        scheduler.clearAll();
        scheduler.parse(events);
    }

We use a global instance of the scheduler, and since it can be mounted multiple times we need to make sure that we add event listeners only once.

In order to do so, we use a custom `scheduler._$initialized` flag. When the scheduler is initialized for the first time, this flag is not defined and we add event listeners and set this flag to `true`. This way we make sure we won’t attach event listeners to the same Scheduler instance again.

That’s how we can capture all changes made in Scheduler and send them to the parent component.

And we need to catch events, create messages for them and put those messages into the local state. To do this, update the App component:

{{ src/App.js }}
    state = {
        currentTimeFormatState: true,
        messages: []
    };
    addMessage(message) {
        const maxLogLength = 5;
        const newMessage = { message };
        const messages = [
            newMessage,
            ...this.state.messages
        ];
 
        if (messages.length > maxLogLength) {
            messages.length = maxLogLength;
        }
        this.setState({ messages });
    }
 
   logDataUpdate = (action, ev, id) => {
        const text = ev && ev.text ? ` (${ev.text})` : '';
        const message = `event ${action}: ${id} ${text}`;
        this.addMessage(message);
    }

After that, create a component that will display these messages on the page:

{{ src/components/MessageArea/MessageArea.js }}
import React, { Component } from 'react';
 
export default class MessageArea extends Component {
    render() {
        const messages = this.props.messages.map(({ message }) => {
            return <li key={ Math.random() }>{message}</li>
        });
 
        return (
            <div className="message-area">
                <h3>Messages:</h3>
                <ul>
                    { messages }
                </ul>
            </div>
        );
    }
}
 
MessageArea.defaultProps = {
    messages: []
};
{{ src/components/MessageArea/index.js }}
import MessageArea from './MessageArea';
import './MessageArea.css';
export default MessageArea;

Add styles:

{{ src/components/MessageArea/MessageArea.css }}
.message-area {
    background: #ebebeb;
    height: 200px;
    overflow: auto;
    padding: 10px;
    box-sizing:border-box;
}
 
.message-area ul{
    margin: 0;
    padding: 0;
    list-style: none;
}
 
.message-area li:before {
    content: "\003e";
    padding-right: 10px;
}

And update the height of the scheduler-container:

{{ src/components/Scheduler/Scheduler.css }}
.scheduler-container {
    height: calc(100vh - 50px - 200px);
    width: 100vw;
}

And finally, connect this component to the App:
imports:

{{ src/App.js }}
import MessageArea from './components/MessageArea';

JSX:

 render() {
        const { currentTimeFormatState, messages } = this.state;
        return (
            <div>
                <div className="tool-bar">
                    <Toolbar
                        timeFormatState={currentTimeFormatState}
                        onTimeFormatStateChange={this.handleTimeFormatStateChange}
                    />
                </div>
                <div className='scheduler-container'>
                    <Scheduler
                        events={data}
                        timeFormatState={currentTimeFormatState}
                        onDataUpdated={this.logDataUpdate}
                    />
                </div>
                <MessageArea
                    messages={messages}
                />
            </div>
        );
    }

Thus, now every time a user changes calendar events, handlers call in the App component and update the MessageArea, which prints information about user actions on the page.

If we run the application, we will see the following result:
React Scheduler with Messages

We hope that our tutorial will come in useful in your projects. Feel free to send us your questions in the comments below if you face any difficulties.

We also invite you to download a ready-made demo of our React Scheduler component from GitHub.

The post How to Use DHTMLX Scheduler Component with React JS Library [Demo] appeared first on DHTMLX Blog.

Customer Spotlight: dhtmlxGantt for GanttPRO

$
0
0

This time we’re excited to share a success story of using our Gantt chart component. The GanttPRO team (Minsk, Belarus) lead by Dmitry Dudin, showcases its online project management solution that, among other tools, is built with dhtmlxGantt. Let’s find out why they opt for dhtmlxGantt and what results are achieved.

About GanttPRO

GanttPRO is a leading industry player with an efficient project management tool for creating Gantt charts and long-term planning. Their solution touches various fields, including IT strategic planning, marketing, construction, and software engineering.

The company’s customer number reached over 540.000 registered users, among which are such industry giants as Amazon, Sony, Salesforce, Shell, and NASA. However, GanttPRO can be used by individuals for every-day life planning. You can find detailed customer stories on their official website.

GanttPRO software was primarily developed for tasks and project management but with time, it extended its field of application. To date, GanttPRO is a fully-fledged system used for team collaboration, time tracking as well as deadline, resource, and cost management. Even though the functionality is constantly improving, the dev team strives to simplify product accessibility.

GanttPRO

We’re proud to say that our Gantt chart JS library has been a core component of GanttPRO for over 5 years. Moreover, the tool is made up of Webix Jet micro framework and different open-source plugins. The client-side was built on Vue.js with a Node.js backend.

Why DHTMLX Gantt?

One of the key reasons why the GanttPRO team chose our Gantt chart library is the best price/value ratio on the market. Indeed, DHTMLX Gantt is a feature-rich Gantt chart component. But what are the most exciting possibilities we offer? Mr. Dudin listed the following:

Auto scheduling

The library gives GanttPRO the ability to schedule tasks automatically based on dependency links between them.

Critical path

With this feature, end-users are able to create a sequence of tasks that can’t be delayed. Otherwise, the whole project would be postponed.

GanttPRO with auto scheduling

Dynamic loading

The GanttPRO team prefers using the dynamic loading mode that allows loading data by sub-projects. So instead of loading all data at once, the tool displays projects level by level as users open them.

Resource management

With GanttPRO, users strike a workload balancing. They can break a project down by resource and easily relocate team members according to their workload.

GanttPRO with resource management

Different time scales

With DHTMLX Gantt, the GanttPRO team is able to set different time scales. Thus, their users can organize a timeline most conveniently, for instance, choosing between hours, days, weeks, months, quarters, and years.

Moreover, the GanttPRO chart calculates the duration of the project based on the custom business calendar. Users can set working days and weekends as well as make adjustments in their project time scales anytime they need.

Tasks grouping

The GanttPRO team also highlighted the ability to group tasks by some criteria.

Besides, the API was characterized as extremely flexible, well documented and easy to understand even for the GanttPRO newbies. As Dmitry said, DHTMLX Gantt has been continuously improving since day one.

Challenges GanttPRO faced

Experience has shown that software development never runs smoothly. The main challenge for the GanttPRO team was the idea to create a global project, in other words, a complex multi-level object on a single page. The solution lies in building several Gantt charts on the same page. Therefore, Dmitry highly recommends DHTMLX users to avoid using the Gantt chart as a global object.

Final Thoughts

Summing up, DHTMLX Gantt helps GanttPRO create a multi-functional project management tool and constantly improve it. For now, the dev team expects to run dhtmlxGantt on the server-side (the ability will be introduced in the next major release) and try out complete mobile support. Moreover, they are working on adding a calendar view that might be developed with a DHTMLX Scheduler component.

We’re very grateful to GanttPRO for sharing their experience of using dhtmlxGantt.

Don’t hesitate to tell us your success story by filling in a form here. We’ll highly appreciate your contribution and please you with a special bonus from the DHTMLX team.

The post Customer Spotlight: dhtmlxGantt for GanttPRO appeared first on DHTMLX Blog.

DHTMLX Gantt 7.0: Node.js Server Module, Setting Working Time in Minutes, New Customization Options, and Much More

$
0
0

Here comes a turning point in the release history of our JavaScript and HTML5 Gantt chart. A new version 7.0 delivers not only several major updates to our client-side library but also rolls out a trailblazing server-side Gantt module for Node.js. This server add-on will give you access to the logic of DHTMLX Gantt and enable you to perform scheduling analysis, receive real-time updates triggered by user actions from different sources, and synchronize Gantt schedule accordingly.

New features of our client-side library v7.0 include the ability to assign resources with different working calendars to the same task using a merged calendar, set working time in minutes, reorder Grid columns by drag-n-drop, customize the Quick Info popup, fine-tune Grid columns by making their width flexible, and manipulate the Content Security Policy (CSP) compatibility via the API. Besides, there are changes in the package structure and the way localization and extensions work in DHTMLX Gantt. Dive deeper into the release details in our article.

DHTMLX Gantt TrialDownload a brand new trial version 7.0 right now >

Using DHTMLX Gantt with Node.js on the Server [New Add-on]

The most groundbreaking novelty of v7.0 is the introduction of the server-side version of DHTMLX Gantt library. Now there is a Node.js build of DHTMLX Gantt intended for running on the server.

It gives developers an opportunity to use complex logic of DHTMLX Gantt – such as auto-scheduling, critical path, and working time calculations – on the server-side. This is essential for synchronizing actions of multiple users from different sources (e.g. desktop and mobile apps or different components of the same app) as well as to conduct scheduling analysis on the server-side and update Gantt on the client-side in real-time.

As DHTMLX Gantt for Node.js is provided as a separate package, you can acquire it as an add-on to the client-side version of Gantt under any commercial license (Commercial, Enterprise, or Ultimate).

Read more about the versioning and installation of Node.js Gantt chart in the documentation >

Specifying Working Time in Minutes

Starting with v7.0, it’s possible to set the working time not only in hours but also in minutes via the setWorkTime property. Thus, a working day can start at 08:15 am and finish at 12:45 pm.

To do so, you need to specify the duration_unit configuration option as “minute”:

gantt.config.duration_unit = "minute";

// sets the working time up to minutes
gantt.setWorkTime({hours:["8:15-12:45"]})

In the following example, we changed the start of the working day, on which Task 1.1 is assigned, from 08:15 to 08:45 am:
Setting work time in minutes - DHTMLX GanttCheck the sample >

Merging Multiple Working Calendars [PRO]

Flexible working hours and floating or shift schedules of employees make it hard to estimate the workload and timeline of a project. To overcome these difficulties, we introduced a new ability to merge different working calendars into one in v7.0.

The resulting work schedule will be based on the overlapping working hours of employees involved in a project. For instance, if working hours of one employee are from 8 am to 4 pm while another employee works from 11 am to 7 pm, the merged calendar will have a work schedule from 11 am to 4 pm. Thus, when you assign several employees to one task, the duration of this task will be calculated on the basis of their common working time.

Merging different calendars into one can be done automatically by setting the gantt.config.dynamic_resource_calendars configuration option to true.

Let’s take two different working calendars of John and Anna as an example. John works on Mondays, Wednesdays, and Fridays, while Anna works on Mondays, Tuesdays, Fridays, and Saturdays. If we enable the dynamic_resource_calendars config, John’s and Anna’s working calendars will merge automatically when they are assigned to the same task. In fact, it means that they will be able to perform a common task on Mondays and Fridays only:

// automatically merge working calendars when multiple resources assigned to a task
        gantt.config.dynamic_resource_calendars = true;
        gantt.config.resource_property = "users";
        gantt.config.resource_calendars = {
            1: gantt.addCalendar({
                worktime: {
                    days: [0, 1, 0, 1, 0, 1, 0]
                }
            }),
            2: gantt.addCalendar({
                worktime: {
                    days: [0, 1, 1, 0, 0, 1, 1]
                }
            })
        };

As shown in the picture below, it takes 5 working days to complete Task 1 for John and Anna, but taking into account that they are both available only on Mondays and Fridays according to their merged working calendar, Task 1 has an overall duration of 15 days:
Merging work calendars in DHTMLX GanttCheck the sample >

If you need to merge working calendars of particular resources only, you can do it manually with the help of the mergeCalendars method:

In the example below, we use the mergeCalendars method to merge John’s and Anna’s working calendars:

const johnCalendarId = gantt.addCalendar({
    worktime: {
        hours: ["0:00-24:00"],
        days: [0, 1, 0, 1, 0, 1, 0]
    }
});
const annaCalendarId = gantt.addCalendar({
    worktime: {
        hours: ["8:00-12:00", "13:00-17:00"],
        days: [0, 1, 1, 0, 0, 1, 1]
    }
});

const joinedCalendar = gantt.mergeCalendars(
    gantt.getCalendar(johnCalendarId),
    gantt.getCalendar(annaCalendarId)
);

Apart from this essential configuration update, we also added the getResourceCalendar method, which returns the calendar of the assigned resource, and updated the resource_calendar config. Besides, from now on, Gantt will recalculate the project schedule automatically when a task calendar changes.

Customizing a Quick Info Popup

V7.0 brought out new customization options of DHTMLX Gantt. We expanded the functionality of the Quick Info extension by introducing the gantt.ext.quickInfo configuration object with a range of methods to manipulate the look and feel of the Quick Info popup:

  • The show() method allows specifying a task, for which the popup should be displayed, as well as X and Y coordinates where to show a popup;
  • The hide() method makes it possible either to hide a popup immediately or apply animation effects;
  • The setContent (config: object) method defines which content to include in a popup like header elements and buttons.

Learn more in the documentation >
Custom quick info popup - DHTMLX GanttCheck the sample >

gantt.locale.labels.custom_button = "My button"
gantt.ext.quickInfo.setContent({
    header:{
        title: "My custom header",
        date: "18th of February, 2020"
    },
    content: "some content here",
    buttons: ["custom_button"]
})
Reordering Grid Columns by Drag-n-Drop

Due to the new configuration option reorder_grid_columns, you can change an order of columns in the Grid by simply moving them using drag-n-drop. By default, this feature is disabled. You can enable it in the following way:

gantt.config.reorder_grid_columns = true;

If needed, you can style the dragged column and the marker highlighting where to place the column with the help of CSS classes.

Reordering grid columns by drag-n-drop - DHTMLX GanttCheck the sample >

Flexible Width of Columns in the Grid

At the request of our users, we decided to add more flexibility to the way Grid columns are displayed in Gantt. Due to the new configuration option grid_elastic_columns, columns will fit the table width by either shrinking or stretching. The horizontal scroll will appear only if the columns’ minimum width is too small to display their content. Check the sample >

By default, this feature is disabled and thus the width of columns is fixed. In order to enable it, you need to set the grid_elastic_column config to true:

gantt.config.grid_elastic_columns = true;

As a cherry on the cake, now you can apply the text-overflow: ellipsis property to display the clipped content of columns in a neat way:
Customizing Grid Columns - DHTMLX Gantt

Please note that starting with v7.0 Gantt uses the CSS flexbox layout in its lefthand Grid columns, what might affect the styling of your Grid in DHTMLX Gantt.

Content Security Policy Update

Starting with v7.0, the Content Security Policy extension is replaced with the config.csp configuration option, which will work out-of-the-box:

gantt.config.csp = "auto";

This configuration option makes Gantt CSP compatible and at the same time ensures the implementation of a high-performance code maintaining a high speed of the component.

By default, the config is set to “auto”, thus allowing Gantt to use a high-performance code wherever it’s possible and resort to a CSP compatible code where it’s necessary. However, depending on your needs, you can disable this config and make Gantt use a high-performance approach by specifying the gantt.config.csp = false or set the gantt.config.csp to true for always applying the CSP compatible code.

Besides, now DHTMLX Gantt makes use only of valid HTML5 data attributes. Learn more >

The CSP update contributes to a more convenient work with our JS Gantt chart, in Salesforce Lightning in particular.

Migration Notes

V7.0 presents some technical changes to the package structure of DHTMLX Gantt. Now all extensions and locales are bundled with the dhtmlxgantt.js file and should be called via Gantt API. Read more about the changes in the Migration article >

To make a long story short, download a trial version 7.0 of our JavaScript Gantt and try out a new Gantt Node.js server module and evaluate them free of charge for 30 days.

We invite our current clients to get the latest Gantt chart version 7.0 in the Client’s Area.

Feel free to leave your feedback in the comments below. We’ll be looking forward to hearing from you!

Related Materials:

The post DHTMLX Gantt 7.0: Node.js Server Module, Setting Working Time in Minutes, New Customization Options, and Much More appeared first on DHTMLX Blog.

DHTMLX Maintenance Release: Gantt 7.0.2, Suite 6.4.3, Scheduler 5.3.7, Pivot 1.4.2

$
0
0

The major update of our flagship product DHTMLX Gantt 7.0 was released last month but our team has already come up with two maintenance versions containing useful fixes and improvements for the Gantt component to smooth the way of any project to success. Moreover, our developers have also provided new patch versions of three other DHTMLX products: Suite, Scheduler, and Pivot. You can become familiar with the whole list of updates below.

DHTMLX Gantt 7.0.1 – 7.0.2

7.0.1 (April 16, 2020)

  • (Updated) major performance improvement for calculation tasks’ duration in the working minutes
  • (Fixed) regression in the Tooltip and Undo extensions which caused the incorrect work when multiple instances of Gantt were created
  • (Fixed) the issue with the reordering of grid columns which caused the timeline to scroll when a mouse pointer moved to the edge of the grid during drag and drop
  • (Fixed) the incorrect position of the column after its dragging and dropping to the right side of the grid border
  • (Updated) dataProcessor custom router should now work correctly with rejected promises
  • (Fixed) the regression in smart rendering which caused some links not to be visible
  • (Updated) Split tasks now display not only the first level children but also all nested subtasks
  • (Fixed) the issue with split tasks and smart rendering which happened when a split task had the ‘task’ type
  • (Fixed) the issue with split tasks which caused the Gantt not to calculate the duration of the ‘project’ tasks nested in a split task
  • (Fixed) the incorrect position of a placeholder after opening an inline editor in the RTL mode

7.0.2 (April 30, 2020)

  • (Fixed) the incorrect work of date formatters when gantt.config.csp is set to true
  • (Fixed) regression in the click_drag and drag_timeline extensions which caused the incorrect work when multiple instances of Gantt were created
  • (Fixed) the incorrect CSS class of a task row element after returning the error status from the dataProcessor router function
  • (Fixed) the incorrect work of inline editors inside Shadow DOM

Learn more in the documentation >

DHTMLX Suite 6.4.2 – 6.4.3

6.4.2 (March 3, 2020)

  • (Fixed) the issue with virtualization behavior in Grid when interacting with Tabbar
  • (Fixed) the issue with clicking on a frozen column in Grid
  • (Fixed) the issue with export data from Grid to Excel
  • (Fixed) the issue with rendering of Chart at zero value
  • (Updated) the status of an active element is added in Menu
  • (Updated) the ability to check validation of values is added in Colorpicker
  • (Fixed) the styles for all inputs with invalid values for Firefox browser

6.4.3 (April 29, 2020)

  • (Fixed) clearing values while using the clear() method for the DatePicker control of Form
  • (Fixed) issues with the CellClick, CellMouseOver, CellMouseDown, CellDblClick, CellRightClick events of Grid when its columns are hidden
  • (Fixed) issue with the keyboard navigation when columns are hidden in Grid
  • (Fixed) the incorrect work of the selection module when Grid columns are hidden
  • (Fixed) the incorrect work of the filtering blocks when columns are hidden in Grid
  • (Fixed) the issue with the redrawing of the table when sizes of a Grid column are changed dynamically
  • (Fixed) the issue with the redrawing of Grid columns when the columns have different sizes
  • (Fixed) the issue with the combo filters when several grids are initialized in the app
  • (Fixed) the behavior of spans in the frozen columns of Grid and TreeGrid
  • (Fixed) the behavior of editors in Grid
  • (Fixed) the issue with the configuration of a Window header
  • (Fixed) the behavior of selection in Grid (the outerClick is deleted)
  • (Fixed) the behavior of charts when zero values are set in a data set
  • (Fixed) the behavior of charts placed into the header of a layout in IE
  • (Fixed) the issue with the configuration of the showText property in Chart
  • (Fixed) calculation of width and height in Chart (Pie, 3DPie, Donut, Radar)

Learn more in the documentation >

DHTMLX Scheduler 5.3.6 – 5.3.7

5.3.6 (February 27, 2020)

  • (Fixed) the incorrect displaying of events in the Day Timeline view when scrollable:true or smart_rendering:true is used
  • (Fixed) the script error which happened in the Day Timeline view after dragging a new event when scrollable:true was used together with dataProcessor
  • (Fixed) the script error which was thrown if no date element was included in the header config
  • (Fixed) the styling of the day tab in the Material skin when the header config does not contain a week or month tab

5.3.7 (April 30, 2020)

  • (Fixed) the incorrect work of the Container Autoresize extension when a horizontal scrollbar is enabled in Timeline view
  • (Fixed) the incorrect work of the show_unassigned configuration option of the Timeline view

Learn more in the documentation >

DHTMLX Pivot 1.4.2

1.4.2 (March 5, 2020)

  • (Fixed) the issue with export data from Grid to Excel
  • (Fixed) behavior of the setFields() method

Learn more in the documentation >

Download the latest versions of our libraries and test them free of charge for 30 days:

Current clients may find the updated packages in their Client’s Area.
Take care of yourself during these challenging times and share with us your thoughts on the recent updates!

The post DHTMLX Maintenance Release: Gantt 7.0.2, Suite 6.4.3, Scheduler 5.3.7, Pivot 1.4.2 appeared first on DHTMLX Blog.


DHTMLX Diagram 3.0: Auto-Layout Algorithm, Smooth Configuration of Custom Shapes, and Fully Customizable Diagram Editors

$
0
0

The major release 3.0 delivered a breakthrough in the functionality of DHTMLX JavaScript diagramming library. The new version introduced an auto-layout algorithm for automatically arranging randomly placed diagram shapes in a neat order in a matter of seconds. Other novelties include a brand new configuration property for applying default settings to all shapes at once, a convenient way of creating custom diagram shapes, and numerous customization options for JavaScript Diagram and Org Chart editors. Besides, it became possible to easily manipulate multiple shapes with the help of multiselection.

Get DHTMLX Diagram 3.0 evaluation version and try out all the new features free of charge for 30 days.

Diagram Auto Layout Algorithm

diagram auto layoutCheck the sample >

The highlight of the release is an automatic layout algorithm, which turns chaotically located Diagram shapes into a hierarchical structure.

In order to make it work, you need to add connectors between shapes. The algorithm has two modes, which differ in the way shapes will be connected. The example above demonstrates both the “direct” mode with diagonal lines between shapes and the “edges” mode with shapes with right-angle connectors.

To enable an automatic arrangement of diagram shapes, you need to apply the autoPlace method with two optional configuration settings for specifying the mode of connecting shapes (“direct”, by default) and distance between separate diagrams in case there are several of them on a page (200px, by default). Alternatively, you can add these settings via the autoplacement config. In the code snippet below, we enable the auto layout in the “edges” mode and 300px distance between diagrams:

var diagram = new dhx.Diagram("diagram");
diagram.data.parse(data);
 
diagram.autoPlace({    
    mode: "edges",    
    graphPadding: 300
});

The diagram layout algorithm is also available in the Diagram editor. The settings of the auto layout can be defined via the autoplacement configuration property as in the example below. Here we have two diagrams: one with square shapes and the other with circle ones situated in random order. The auto-layout algorithm will arrange both diagrams in the “direct” mode with diagonal connectors and 100px distance between diagrams:

var editor = new dhx.DiagramEditor(document.body, {
    autoplacement: {
        graphPadding: 100,
        mode: "direct"
    }
});

Diagram editor auto layoutCheck the sample >

Our brand new hierarchical layout algorithm accelerates the creation of beautiful and complex diagrams from the UI. End-users no longer have to spend time and effort in an attempt to place each shape neatly. Now they just need to choose the necessary shapes from the right panel, connect them to each other, and press the Auto Layout button to achieve an orderly look and feel:

Auto layout in editorCheck the sample >

One Property for the Default Configuration of All Shapes

DHTMLX diagramming library 3.0 introduced a new configuration property, which alone is able to save you lots of time and effort when you are creating a complex diagram with a big data set. The new defaults config can encompass almost all configuration options of different types of shapes significantly reducing the size of your code.

Let’s take a closer look at it in the following example:

const defaults = {
    start: {
        fill: "#FE9998",
        stroke: "#FE9998",
        fontColor: "#FFF",
        lineHeight: 16
    },
    end: {
        fill: "#FE9998",
        stroke: "#FE9998",
        fontColor: "#FFF",
        lineHeight: 16
    },
    process: {
        fill: "#478D99",
        stroke: "#478D99",
        fontColor: "#FFF",
        lineHeight: 16
    },
    decision: {
        fill: "#F7D768",
        stroke: "#F7D768",
        fontColor: "#FFF",
        lineHeight: 16
    },
    document: {
        fill: "#478D99",
        stroke: "#478D99",
        fontColor: "#FFF",
        lineHeight: 16
    }
};

const diagram = new dhx.Diagram("diagram", {
    defaults: defaults
});
diagram.data.parse(activity);

JavaScript Activity DiagramCheck the sample >

In the picture above you can see an Activity diagram depicting a flow of business activities. The defaults config contains a set of default configuration options for each flowchart shape used in this diagram. For instance, all Process shapes are colored in cyan (#478D99), with white font, and fixed line-height (16px). Even if we enlarge the data set with hundreds of new activities to be illustrated with Process shapes, our code will still remain as neat and concise as before.

New Simple Method to Create Custom Shapes

V3.0 delivered a new API method for easily creating custom Diagram and Org Chart shapes. The new addShape method enables developers to specify a unique template for a newly added shape, which can contain any custom elements like images, icons, or other custom content. Optionally, you can set the default configuration of shapes with the help of the defaults property.

Below you can see a code example of how to create a custom shape with the help of the addShape method for a Network diagram. Here we use an HTML template, according to the ES6+ standard, to define which custom elements to include in a shape: image, text, and a string of numbers for IP address. We specify the defaults config to add the default properties of a Network diagram shape such as width, height, image path, text, and IP address. These properties can be overridden in the configuration of each particular shape if needed:

diagram.addShape("networkCard", {
template: config => (
        <section class='network_template'>;
            <img src='${config.img}’ alt='${config.text}'></img>
            <span>${config.text}</span>
            <span>${config.ip}</span>
        </section>
    ),
    defaults: {
        width: 160,
        height: 160,
        img: "../common/img/network_image/desktop.svg",
        text: "Network Card",
        ip: "138.68.41.78",
    }
});

Thus, you can create a slick Network diagram like in the picture below:
JavaScript Network DiagramCheck the sample >

Adding Custom Shapes into Live Diagram Editors

The addShape method also serves to quickly add custom shapes into live Diagram and Org Chart editors. All you need to do is to set the addShape method in the editor configuration object and apply the desired template with the default settings (if needed). The icing on the cake, all custom shapes will be automatically rendered in the editor’s left panel as shape previews.

Customization options delivered in v3.0 let you fine-tune the look and feel of Diagram and Org Chart editors. You can tailor-make the editors’ left and right panels entirely to your needs.

Customizing the Left Panel

The new shapeSections configuration property enables you to categorize all shapes into several groups and show them in corresponding sections in the left panel of the Diagram editor. Additionally, you can control how shapes are previewed there.

In the example below, we added four sections with previews for Custom, Sticky, Org Chart, and Flowchart shapes. Besides, we made use of the scalePreview configuration option to define the size of a shape preview:

const editor = new dhx.DiagramEditor(document.body, {
    shapeSections: {
        "custom shapes": ["networkCard", "medCard"],
        "sticky shapes": ["blue", "orange"],
        "org chart shapes": ["card", "img-card"],
        "flowchart shapes": [true],
    },
    scalePreview: 0.65,
});

Left Panel of Diagram EditorCheck the sample >

Alternatively, it’s possible to add an image instead of an automatically rendered shape preview with the help of the preview property of the defaults attribute for previewing a particular shape. The width and height parameters can be specified to define the size of an image preview.

Moreover, you can change the distance between shape previews using the gapPreview property and specify the width of the left panel using the shapeBarWidth configuration property.

Customizing the Right Panel

JavaScript UML Class Diagram - EditorCheck the sample >

The right panel of the Diagram editor will automatically render sidebar options for editing custom shapes with standard attributes like title, text, fill, stroke, etc. depending on the dataset, as shown in the example above.

However, dealing with complex custom shapes you might need to equip the editor with special tools for modifying various custom elements in Diagram and Org Chart editors. For that purpose, we introduced the properties attribute of the addShape method, which allows changing the sidebar options available for editing by end-users in the right panel.

For instance, here is an Org Chart editor with custom shapes to illustrate the hierarchy of a medical establishment:

Check the sample >

Custom Org Chart shapes contain several text elements for a doctor’s name and position, fields for a phone number and email address, and a photo. Each element can be edited from the UI due to a range of editing tools in the right panel. As you can see in the code example, the properties attribute includes options for defining the shape’s position and size, doctor’s name, post, phone number, and email address as well as a photo to be loaded into the chosen shape. Editing options are represented in the sidebar exactly in the same order in which they are specified in the properties attribute:

editor.diagram.addShape("template", {
    template: template,
    defaults: {
        name: "Name and First name",
        post: "Position held",
        phone: "(405) 000-00-00",
        mail: "some@mail.com",
        photo: "../common/big_img/big-avatar-1.jpg",

        height: 115, width: 330
    },
    properties: [
        { type: "position" },
        { type: "size" },
        { type: "text", label: "name", property: "name" },
        { type: "text", label: "post", property: "post" },
        { type: "text", label: "phone", property: "phone" },
        { type: "text", label: "email", property: "mail" },
        { type: "img", label: "photo",  property: "photo" }
    ]
});

Additionally, now you can define which controls to make available in the Editor via the controls property. For instance, you can enable the Import and Export controls, the Grid Step option, which sets the step of moving shapes, the Auto Layout control, and the Edit Mode button, and disable the Undo and Redo, Apply and Reset changes buttons:

var editor = new dhx.DiagramEditor(document.body, {
    controls: {
        import: true,
        export: true,
        gridStep: true,
        autoLayout: true,
        editMode: true,
        historyManager: false
        apply: false,
        reset: false
    },
});
Multiselection of Shapes

Another significant enhancement in the work of editors is the ability to manipulate several shapes and connectors at once. V3.0 brought out the multiselection feature for dragging, copying, pasting, and deleting shapes. To select multiple shapes, you can either hover the mouse over them while keeping the left mouse button pressed or left click on each shape while pressing Shift.

Shapes' multiselectionCheck the sample >

New Use Cases for Searching and Zooming in Diagrams

We prepared a couple of new samples covering the most popular cases of using JavaScript diagrams, according to our users’ requests.
One of the demanded examples is implementing a search functionality for navigating through vast Diagrams and Org Charts:
Search in JavaScript org chartCheck the sample >

Another sample demonstrates how Org Chart shapes change their appearance depending on the scale while zooming in and out:
ZoomCheck the sample >

We do hope that the new functionality and samples of DHTMLX Diagram 3.0 will come in useful in your applications. Dive into the new features by downloading a free 30-day trial version and benefit from the assistance of our technical support team if any questions arise.

We’ll be looking forward to your feedback – leave your comments below!

Current clients are invited to get the latest version of the DHTMLX Diagram in their Client’s Area.

Stay tuned for future updates!

Related Materials:

DHTMLX Diagram Free Trial

The post DHTMLX Diagram 3.0: Auto-Layout Algorithm, Smooth Configuration of Custom Shapes, and Fully Customizable Diagram Editors appeared first on DHTMLX Blog.

HIPAA and GDPR Compliance: How We Protect Your Personal Data

$
0
0

In this article, we’ll talk about DHTMLX security concerns, namely GDPR and HIPAA compliance.

Personal data privacy has always been important. Especially now, when more and more information becomes digitized. Our company takes all necessary measures to ensure the personal data of our trial users and customers stay safe, accurate, and confidential.

In our work, we at DHTMLX comply with the General Data Protection Regulation (GDPR) that enables us to protect the personal data and privacy of EU residents and citizens. Besides, regarding healthcare-related software, we respect the Health Insurance Portability and Accountability Act (HIPAA) and don’t prevent our users from building a HIPAA-compliant project with the help of our UI libraries and components.

Let’s have a closer look at the basic principles we follow when collecting and processing user data.

Maintaining GDPR Compliance

EU GDPR came into effect in May 2018 and gives netizens more control over their personal data. Today, user consent is principally required when collecting personal information. This concerns any information relating to personally identifiable information, including name, location, IP addresses, and much more.

The Regulation has an extraterritorial effect and applies to all organizations processing personal data of EU residents and citizens. Thereby, we at DHTMLX conscientiously fulfill GDPR requirements and always make sure we have the users’ permission to handle their personal data.

When working with users’ personal data, we maintain the following basiс principles.

  • Purpose limitation

All personal data gathered through our website is used for the purposes of client reporting and statistical analysis. Thus, for instance, we can use your email address to inform you about new releases and updates, provide you with official technical and non-technical support, and to get your feedback on the products you use.

  • Data minimization

Our policy is to only collect personal information that is required for data processing purposes unless you share it voluntarily. When you interact with our website, you may provide us with your name, email address, and company name. Moreover, we may compile other information when you take part in our survey and contests.

  • Storage limitation

Your personal data is maintained only for a time period required to send you the relevant updates and provide you with official paid technical support. Thus, we request your permission on collecting your personal data and will keep it until you withdraw your consent.

  • Accuracy

We store personal information of our evaluation users and clients and can edit or delete data on request. All the data collected will be deleted within 30 days.

  • Integrity and confidentiality

When processing personal data of our users, we ensure protection against unauthorized processing, data corruption, and deletion. We use third-party software for monitoring website activity and processing orders and payments. However, any personally identifiable information is not transferred or disclosed to outside software providers.

For example, you can enter the card credentials when paying by a credit or debit card for your order. All the payment documents, including receipts, invoices, and confirmations, you get from the e-commerce provider.

We, in turn, do not receive your payment data. The provider sends us your name, email address, phone number, company name, and Order ID assigned to your purchase. This part of your personal data is used to provide you with the relevant license information, the download link to software products, as well as your login credentials to the Clients Area and Support Center.

  • Legitimacy and transparency

Any website visitor can find information about the purposes, methods, and amount of personal data processed. This information is clearly and consistently explained.

Respecting HIPAA Regulations

Many businesses are loosely acquainted with HIPAA and HITECH Act Rules so they usually associate them with hospitals, medical practices, and health insurance companies. However, HIPAA compliance rules apply to countless software vendors that handle protected health information (PHI) or work with healthcare-related organizations.

For instance, HIPAA sets U.S. national standards to protect individuals’ medical records and other personal health information. Regulations apply to those who conduct certain healthcare transactions electronically.

HIPAA requires appropriate safeguards to handle PHI to make sure it’s accessed, stored, and transmitted securely. This includes any demographic information that can be used to identify a patient, such as his/her name, date of birth, Social Security and phone numbers to name a few. Patients also have rights over their health information, including rights to review a copy of their health records and obtain corrections.

The HIPAA Breach Notification Rule regulates the provisions for appropriate notifications in case of a data breach and unauthorized distribution.

Summing up, the mandatory features for HIPAA compliant software include:

  • User authorization
  • Access control
  • Unique user identification
  • Role-based authorization
  • Emergency access
  • Automatic logoff
  • Data encryption and decryption
  • SSL/TLS certificates usage
  • Data backup

As for DHTMLX, we provide effective and professionally designed web-based tools that enable developers to build complex applications for various areas. Among our clients are many companies and IT specialists who can use (or already use) DHTMLX libraries for healthcare software development. However, we do not have access to any data our users store in their systems. You can be sure of data privacy and security while observing HIPAA requirements and independently implement compliant software features.

Conclusion

Summing up, our company takes all adequate measures to provide HIPAA and GDPR-compliant software solutions. If you still have any questions or concerns, feel free to contact us by using the form and we’ll get back to you as soon as we can.

The post HIPAA and GDPR Compliance: How We Protect Your Personal Data appeared first on DHTMLX Blog.

How to set up inline editors and edit JavaScript Gantt data on the fly

$
0
0

An essential feature of Gantt charts is the ability to edit projects’ data quickly. In this video tutorial, we’re going to share tips on how to set up inline editing and enable end-users to create and change Gantt tasks right from the UI.

There are two ways of how end-users can edit Gantt data:

  • using the Lightbox edit form;
  • via inline editors in the Grid area.

Inline editors give users a great advantage over the lightbox form speeding up the process of editing tasks and interacting with our HTML Gantt chart. Thus, all changes into Gantt data like creating or updating tasks, connecting them, and defining task dates and duration, can be made right through the grid via built-in editors.

Built-in editors for editing Gantt data from the UI

Let’s dive deeper into the settings of DHTMLX Gantt inline editors.

You can make Gantt column editable by adding the editor property to it:

var textEditor = {type: "text", map_to: "text"};
var dateEditor = {type: "date", map_to: "start_date", min: new Date(2020, 0, 1), max: new Date(2021, 0, 1)};
var durationEditor = {type: "number", map_to: "duration", min:0, max: 100};

gantt.config.columns = [
     {name: "text", tree: true, width: '*', resize: true, editor: textEditor},
     {name: "start_date", align: "center", resize: true, editor: dateEditor},
     {name: "duration", align: "center", editor: durationEditor},
     {name: "add", width: 44}
];

The editor object should have the type property that should match one of the defined types of editors and the map_to property that binds the editor to the property of the task object.

The rest of the settings are specific to certain types of editors. For example, you can specify minimum and maximum values for the number and date editors.

You can also define a new type of editor by adding a specially formatted object into the Gantt config. The public API of editors is quite extensive, providing methods and events to control every aspect of their work.

How to create a custom inline editor

Let’s say you need to specify the colors of Gantt tasks. There is no built-in color picker in the grid of Gantt for changing tasks’ colors, so let’s set up a custom inline editor on our own.

To do so, firstly, we need to add an extra column to the grid of Gantt and place a color picker inside. We can take a simple HTML5 color input for a start.

Let’s copy the code example from the documentation and use it as a template:

gantt.config.editor_types.color = {
  show: function (id, column, config, placeholder) {
        var html = "<div><input type='color' name='" + column.name + "'></div>";
        placeholder.innerHTML = html;
  },
  hide: function () {},
  set_value: function (value, id, column, node) {
    this.get_input(node).value = value;
  },
  get_value: function (id, column, node) {
    return this.get_input(node).value || "";
  },
  is_changed: function (value, id, column, node) {
    var input = this.get_input(node);
    return input.value !== value;
  },
  get_input: function(node) {
    return node.querySelector("input");
  },
  is_valid: function (value, id, column, node) {
    var input = this.get_input(node);
    return !!input.value;
  },
  focus: function(node){
    var input = this.get_input(node);
    input.focus();
  }
}

Make sure to rename the control and change the show function to create a color input.

We won’t need the hide method since our input doesn’t need any destructor or post-processing after it’s hidden, so we can leave it empty.

The next two important methods are set_value and get_value. The former is called when the editor is opened to populate it with the value from the task. And the latter is called when the user saves the editor; the return value will be applied to the task object.

The next step is the is_changed function. Since editors can be opened and closed easily, we only want to trigger data change when the user has modified the editor value. Inside this method, we’ll need to compare the initial value provided to the editor with the current one and return boolean true if values differ. Returning true will update the task with the new value, returning false will simply close the editor.

The is_valid method works as it sounds, returning false will tell Gantt that the input value is not valid and should be discarded.

The save method is needed for complex editors (such as predecessor selectors) that make multiple changes rather than modify a single property of a task. So let’s delete it.

And finally, the focus method that should put a browser focus into our editor.

Now we have a ready-to-use inline editor for selecting task colors.

The next step is to add a new column to the grid config and attach the editor config to it. Note that the type property of the color editor must match the name we used for our editor above. The map_to value will define the property of the task object for the editor to write values to. We use the color property there since Gantt will automatically apply colors from this property:

var textEditor = {type: "text", map_to: "text"};
var dateEditor = {type: "date", map_to: "start_date", min: new Date(2020, 0, 1), max: new Date(2021, 0, 1)};
var durationEditor = {type: "number", map_to: "duration", min:0, max: 100};
var colorEditor = {type: "color", map_to: "color"};
 
gantt.config.columns = [
    {name: "text", tree: true, width: '*', resize: true, editor: textEditor},
    {name: "start_date", align: "center", resize: true, editor: dateEditor},
    {name: "duration", align: "center", editor: durationEditor},
    {name: "color", align: "center", label:"Color", editor: colorEditor},
    {name: "add", width: 44}
];

Now if we add some values to the data you should see it in action:

Color picker in DHTMLX Gantt

As a final touch, we’ll properly display colors inside the color column. It’s done via a template the way we showed you in one of our previous video tutorials. We’ll define a template that will return a div element with a specified background color style:

{name: "color", align: "center", label:"Color", editor: colorEditor, template:
    function(task){
        return "<div class='task-color-cell' style='background:" + task.color + "'></div>"
}},

And apply some styles to display it correctly:

.task-color-cell{
  margin:10%;
  width:20px;
  height:20px;
  border:1px solid #cecece;
  display:inline-block;
  border-radius:20px;
}

HTML5 color picker in DHTMLX GanttCheck the sample >

How to create an inline editor with a third-party color picker

In case you want to use a proper color picker widget, the code won’t differ a lot. We can integrate a third-party color picker such as a jquery plugin named Spectrum.

The first step is to add the files of the Spectrum library to our sample.

After that, update our control. We’ll define a variable where we’ll store a reference to our editor instance. We’ll need it to call a destructor when the input is hidden:

var editor;
gantt.config.editor_types.color = {
  show: function (id, column, config, placeholder) {
        var html = "<div><input type='color' name='" + column.name + "'></div>";
        placeholder.innerHTML = HTML;

        editor = $(placeholder).find("input").spectrum({
          change: function(){
            gantt.ext.inlineEditors.save();
          }
        });
        setTimeout(function(){
          editor.spectrum("show");
        })
  },
  hide: function () {
    if(editor){
      editor.spectrum("destroy");
      editor = null;
    }
  },
  set_value: function (value, id, column, node) {
    editor.spectrum("set", value);
  },
  get_value: function (id, column, node) {
    return editor.spectrum("get").toHexString();
  },
  is_changed: function (value, id, column, node) {
    var newValue = this.get_value(id, column, node);
    return newValue !== value;
  },
  is_valid: function (value, id, column, node) {
    var newValue = this.get_value(id, column, node);
    return !!newValue;
  },
  focus: function(node){
    editor.spectrum("show");
  }
}

First, we need to modify our show method. When it’s called we need to initialize and display the color picker widget. Note that in our example we call the show method from a timeout. It’s needed to ensure that we’ll attempt to display it after all HTML elements are inserted into the document.

Next, we’ll need to define the hide method. We’ll call the destructor when the editor is closed.

The rest of the methods are relatively intuitive and don’t differ too much from our original implementation. We need to modify the way the value is obtained from the control.

After it’s done everything should work as expected.

DHTMLX Gantt with built-in color pickerCheck the sample >

Ready to try it out yourself? Download a free Gantt trial version and follow our video tutorial!

Previous tutorials from the series:

If you’re interested in any other topics for building your own Gantt chart, leave your thoughts in the comment section below and follow DHTMLX youtube channel to stay tuned!

The post How to set up inline editors and edit JavaScript Gantt data on the fly appeared first on DHTMLX Blog.

DHTMLX Suite 6.5: TypeScript Definitions, Grid and TreeGrid Columns’ Drag-n-Drop, Grouping TreeGrid Data, and New Angular Demo

$
0
0

The summer season at DHTMLX opens with a major release of our JavaScript UI library – Suite 6.5.

The update accommodated some highly demanded features requested by our clients like TypeScript support, grouping TreeGrid data, and drag-n-drop of columns in Grid and TreeGrid. Besides, our development team designed new examples of using Suite UI components with Angular. Other features and improvements cover new configuration options and methods for manipulating content in Grid and TreeGrid, List and DataView, and managing Form controls and Sidebar options.

Jump into evaluating Suite UI library 6.5 free of charge for 30 days right now.

Or read the release article to take in every detail.

Built-in TypeScript Definitions

As TypeScript gained considerable popularity among web developers and its support was particularly demanded by our users, we incorporated TypeScript definitions into our UI components.

From now on, built-in type definitions will help you save time and write clean and stable code with the help of type suggestions, autocompletion, and type checking. Check how it works in our code snippet >
TypeScript support for UI components - DHTMLX Suite

Angular Examples

Together with the release of Suite 6.5, our dev team prepared examples of all Suite components with Angular. The examples cover basic initialization and usage as well as event listening. The full source code of our components used with Angular can be found on GitHub.

To get the idea of how it works, have a look at the initialization of DHTMLX Calendar with Angular:

import { Output, Component, ViewChild, OnDestroy, ElementRef, EventEmitter } from '@angular/core';
import { Calendar as CalendarDHX } from 'dhx-suite';

@Component({
    selector: 'app-calendar',
    template: `<div #widget></div>`,
})
export class CalendarComponent implements OnDestroy {
  @ViewChild('widget', { static: true })
  container: ElementRef;
  calendar: CalendarDHX;
  wait: Promise<void>;

  @Output() ready: EventEmitter<any> = new EventEmitter();

  ngOnInit() {
    this.calendar = new CalendarDHX(this.container.nativeElement, {
      css: 'dhx_widget--bordered',
      value: new Date(),
    });
  }

  ngOnDestroy() {
    this.calendar && this.calendar.destructor();
  }
}

Check full source code on GitHub >

Besides, our team revised DHTMLX React examples on GitHub and got down to preparing samples with Vue.js.

Dragging and Dropping Columns in Grid and TreeGrid [PRO]

Drag-n-drop of columns in DHTMLX Grid and TreeGrid
Check the snippet >

In addition to reordering rows, starting from v6.5, it became possible to move Grid and TreeGrid columns via drag-n-drop. To enable this functionality, you only need to specify the dragItem: “column” property in the configuration of Grid or TreeGrid:

var grid = new dhx.Grid("grid_container", {
      columns: [// columns config],
      dragItem:"column",      
      data: dataset
});

If you need to prevent a particular column from being moved, you can add the draggable: false option to its config:

var grid = new dhx.Grid("grid_container", {
    columns: [
        { width: 200, id: "country", header: [{ text: "Country" }], draggable: false },        
        { width: 150, id: "land", header: [{ text: "Land" }] },
        { width: 150, id: "density", header: [{ text: "Density" }], draggable: false }    
    ],
    data: dataset,
    dragItem: "column",  
});

To help you customize the user experience, we enlarged the list of events with new ones: beforeColumnDrag and beforeColumnDrop, which fire before users drag and drop columns.

Grouping TreeGrid Data

Another long-awaited feature of Suite 6.5 is the ability to group data in TreeGrid columns according to specific criteria.

A basic example is grouping TreeGrid data by values of a particular column. In order to implement this functionality, you need to make use of the groupBy() method and pass the id of the column as its parameter:

treegrid.groupBy("age");

However, some use cases presuppose a more advanced approach. For instance, we need to group countries according to their size and split them into three categories: small, medium, and big. TreeGrid enables you to pass a function with a rule as a parameter to the groupBy() method, which will determine how to group data.

In the example below, we define that all countries with an area less than 25000 square km fall into the “Small” group, while the “Medium” group includes countries smaller than 60000 square km. If there are countries with values less than 0, they are categorized as N.A. The rest of the countries constitute the “Big” group:

Grouping TreeGrid data by areaCheck the sample >

treegrid.groupBy(function (item) {
    if (!item.area || item.area < 0) {
        return "N.A.";
    }
    if (item.area < 25000) {
        return "Small";
    } else if (item.area < 60000) {
        return "Medium";
    }
    return "Big";
});

Moreover, you can modify the title of a group by setting a template with the help of the groupTitleTemplate configuration option. Thus, you can include the group name and any other attributes you need there. For instance, in the sample below, group titles include not only their names but also the calculated average density of countries:
Grouping TreeGrid data by densityCheck the sample >

groupTitleTemplate: function(groupName, items) {
     return groupName + " (Avg. Density: " + Math.floor(items.reduce((acc, i) => acc + Number.parseInt(i.density), 0)/items.length) + ")";
}
Changing the Alignment of Columns in Grid and TreeGrid

V6.5 enriched the abilities of Grid and TreeGrid with one more configuration option for aligning the content of columns and their headers. The new align config allows you to implement left, right, or center alignment of content:

var grid = new dhx.Grid("grid_container", {
      columns: [
               { id: "name", header: [{ title: "Name", align: "center" }], align: "left"}
              // more options
      ],
     data: dataset
});

Alignment of columns in DHTMLX GridCheck the sample >

Disabling Tooltips in Grid and TreeGrid

Another enhancement concerns the usage of tooltips in DHTMLX Grid and TreeGrid. From now on, you can disable tooltips for any chosen element of these components: entire columns or specific cells.

Disabling tooltips in DHTMLX TreeGridCheck the sample >

It can be done via the tooltip configuration option like in the example below:

var treeGrid = new dhx.TreeGrid("treegrid", {
      columns: [
    { width: 280, id: "name", header: [{ text: "Book Name" }], tooltip: true },
    { width: 160, id: "price", type: "string", header: [{ text: "Terms and conditions", colspan: 2 }, { text: "Price" }] },
    { width: 160, id: "cover", type: "string", header: [{}, { text: "Cover" }] },
    { width: 160, id: "ships", type: "string", header: [{ text: "Ships in" }] },
    { width: 160, id: "inStock", type: "string", header: [{ text: "In stock" }] }
    ],
    data: dataset,
    tooltip: false
});
Adjusting Columns’ Width to Their Footer in Grid and TreeGrid

As a final touch, we updated the adjust property in the configuration of Grid and TreeGrid components. Now the width of columns (all at once or separate ones) can be adjusted to the width of their footer:

var grid = new dhx.Grid("grid_container", {
    columns: [// columns config],
    adjust: "footer",    
    data: dataset
});

Adjusting columns' width in GridCheck the sample >

Manipulating the Selection of Items in DataView and List

V6.5 provides you with the ability to manage the selection of DataView and List items with the help of the newly introduced configuration options and methods.

Starting with v6.5, the selection configuration property serves to enable and disable items selection:

var dataview = new dhx.DataView("dataview", {
    selection: false
});

Besides, you can apply the enableSelection and disableSelection methods for this purpose.

Manipulating the Visibility of Form and its Controls

V6.5 delivered plenty of new methods and options for improving your work with DHTMLX Form.

Now it’s much easier to manage the visibility of the entire Form as well as separate controls. You can make a form hidden via the new hidden configuration property or using the hide method. The show method makes a form visible. The isVisible method enables you to check if a form is visible at the moment.

You can apply the same methods to manipulate the visibility of Form controls (buttons, input fields, select boxes, etc.). In order to add interactivity to your form, you can attach new event handlers to Form controls: afterHide, afterShow, beforeHide, and beforeShow.

Besides, we enriched the abilities of the select control and simpleVault control.

Now you can get an array of all options of the select control via the getOptions() method. The setOptions() method enables you to modify select options dynamically.

New methods of the simpleVault control allow you to open the dialog box and select files for uploading via the selectFile() method, send a POST request for uploading files to the server via the send() method and specify the default list of loaded files via the setValue() method.

Selecting Sidebar Items

DHTMLX Sidebar was also updated with new methods for selecting and deselecting Sidebar options as well as checking if an option is selected or not. Check the sample >

Now that you have learned about the update of our Suite UI library v6.5, we invite you to test all the components during a free 30-day evaluation period.

We’re looking forward to your feedback – feel free to let us know what you think in the comment section below or via our email: contact@dhtmlx.com.

Current clients are invited to download the latest version in their Client’s Area.

Stay safe and stay tuned for DHTMLX summer updates!

Get Free Trial v6.5 Now

Related Materials:

The post DHTMLX Suite 6.5: TypeScript Definitions, Grid and TreeGrid Columns’ Drag-n-Drop, Grouping TreeGrid Data, and New Angular Demo appeared first on DHTMLX Blog.

Vue.js Integration for Suite UI Components

$
0
0

After delivering integration examples with two widely used frameworks: Angular and React, we settled down to Vue.js. You can find live samples of Suite UI components together with the full source code that you can use in your Vue-based apps on our GitHub Pages.

Examples of UI components with Vue.js are divided into five sections:

  • Basic initialization via npm
  • Preconfigured component
  • Work with data
  • Basic initialization via CDN
  • Event listening

Each component has a link to its documentation to help you grasp all configuration options.

Let’s take a look at the example of DHTMLX Colorpicker initialized using Vue.js via npm:

<template>
  <div ref="colorpicker"></div>
</template>

<script>
import { Colorpicker as ColorpickerDHX } from "dhx-suite";
export default {
  name: "ColorpickerBase",
  data: () => ({
    colorpicker: null,
  }),
  mounted() {
    this.colorpicker = new ColorpickerDHX(this.$refs.colorpicker);
  },
  beforeDestroy() {
    if (this.colorpicker) {
      this.colorpicker.destructor();
    }
  },
};
</script>

View full source code >

DHTMLX Colorpicker with Vue.jsView live demo >

Here is our Colorpicker widget based on Vue.js in the picker mode only:

<template>
  <div ref="colorpicker"></div>
</template>

<script>
import { Colorpicker as ColorpickerDHX } from "dhx-suite";
export default {
  name: "ColorpickerConfigurated",
  data: () => ({
    colorpicker: null,
  }),
  props: {
    options: {
      type: Object,
      required: true,
    },
  },
  mounted() {
    this.colorpicker = new ColorpickerDHX(this.$refs.colorpicker, {
       pickerOnly: true
    });
  },
  beforeDestroy() {
    if (this.colorpicker) {
      this.colorpicker.destructor();
    }
  },
};
</script>

View full source code >

Picker mode of DHTMLX Vue.js ColorpickerView live demo >

Our Vue.js examples are intended for faster development of web applications based on Suite UI components. You can try our UI library for free during a 30-day evaluation period. Our official technical support team will provide you with guidance if any questions arise.

Related Materials:

The post Vue.js Integration for Suite UI Components appeared first on DHTMLX Blog.

Viewing all 208 articles
Browse latest View live