Skip to main content Skip to footer

How to Set Up a Wijmo JavaScript FlexGrid Using CDNs

Quick Start Guide
What You Will Need

VanillaJS

Wijmo

Controls Referenced

FlexGrid

Tutorial Concept Learn how to set up a FlexGrid using CDNs in JavaScript.

A Content Delivery Network (CDN) is a network of distributed servers positioned across different locations. The primary purpose of a CDN is to deliver web content, such as HTML pages, JavaScript files, CSS stylesheets, images, and videos, more efficiently and reliably. When a user requests content from a website, the CDN routes that request to the nearest server in its network, reducing latency and improving load times.

Integrating Wijmo with a CDN offers several advantages for developers and users alike. Firstly, leveraging a CDN allows developers to offload the hosting of Wijmo libraries and resources to globally distributed servers maintained by the CDN provider. This results in faster downloads and improved performance for end users, as they can access Wijmo files from servers that are physically closer to them, reducing latency and network congestion.

Moreover, using a CDN for Wijmo eliminates the need for developers to manually download, manage, and update the libraries on their own servers. Instead, developers can simply include Wijmo's CDN links in their HTML files, ensuring they always have access to the latest versions of Wijmo without worrying about maintenance overhead.

Additionally, CDNs often provide features like content caching, which further enhances performance by storing copies of frequently accessed files on edge servers. This means that subsequent requests for the same content can be served more quickly from the cache, reducing the load on origin servers and improving overall responsiveness.

While CDNs offer numerous advantages, nothing is perfect, and there are some potential drawbacks to consider, such as the dependence on a third-party service. If the CDN experiences downtime or performance issues, it can affect your application's accessibility and user experience. This is why the standard overtime has shifted to using NPM. To learn more about referencing Wijmo with NPM, check our documentation.

In summary, leveraging a CDN for Wijmo integration offers improved performance, reduced latency, simplified maintenance, and enhanced scalability. Although there are some drawbacks, like being dependent on a third party, a CDN is an excellent choice for developers looking to deliver high-quality web applications with rich and responsive user interfaces. For more details about referencing Wijmo with CDNs, check out our documentation.

In this blog, we'll set up Wijmo FlexGrid using CDNs by following the steps below:

  1. Create a New HTML File
  2. Add CSS Links and Script Tags
  3. Create a Container for the FlexGrid
  4. Add Wijmo FlexGrid JavaScript
  5. Customize and Extend Features
  6. Test Your Application

Ready to Get Started? Download Wijmo Today!

Now, let's see Wijmo's CDN in action!

Step 1: Create a New HTML File

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Wijmo FlexGrid Example</title>
    <!-- Wijmo FlexGrid CSS link will go here -->
    
</head>
<body>
    <!-- Your content goes here -->


    <!-- Wijmo FlexGrid script tag will go here -->
  
    <script>
        // JavaScript code to initialize and configure FlexGrid will go here
    </script>
</body>
</html>

Step 2: Add CSS Links and Script Tags

Inside the head tag of your HTML file, include the Wijmo FlexGrid CSS file using the link tag:

<link
   rel="stylesheet"
   href="https://cdn.mescius.com/wijmo/5.latest/styles/wijmo.min.css"
/>

Before the closing of the body tag, include the script tag containing the CDN for Wijmo's FlexGrid:

<script src="https://cdn.mescius.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<script src="https://cdn.mescius.com/wijmo/5.latest/controls/wijmo.grid.min.js"></script>

Step 3: Create a Container for the FlexGrid

Create a div element in the body of your HTML file to serve as a container for the FlexGrid. Give it an ID to connect with the JavaScript code, for example, "flexGridContainer":

<div id="flexGridContainer"></div>

Step 4: Add Wijmo FlexGrid JavaScript

At the bottom of the body tag of your HTML file, just under the script tag containing the CDN, add this code to initialize and configure the FlexGrid:

<script>
    document.addEventListener('DOMContentLoaded', function() {
        // Initialize FlexGrid
        let flexGrid = new wijmo.grid.FlexGrid('#flexGridContainer');

        // Set data source (replace with your data source)
        let data = new wijmo.collections.CollectionView([
            { id: 1, name: 'John', age: 30 },
            { id: 2, name: 'Jane', age: 25 },
            { id: 3, name: 'Doe', age: 40 }
        ]);
        flexGrid.itemsSource = data;
    });
</script>

Step 5: Customize and Extend Features

You can further customize and extend FlexGrid's features and functionality as needed for your application. Refer to the Wijmo FlexGrid documentation for more information on available features and options.

Step 6: Test Your Application

Save your HTML file and open it with a web browser to see the Wijmo FlexGrid in action with the configuration and data you provided.

That's it! You have successfully set up Wijmo FlexGrid using CDNs in a Vanilla JavaScript application. You can find the reference code for this application on StackBlitz.

Ready to Try It Out? Download Wijmo Today!

Now, let's see Wijmo's CDN in action!

Happy coding!

Tags:

comments powered by Disqus