jqWidgets: The information and table are not appearing on the screen

In my Angular project, I am utilizing jqWidgets to create a grid using jqxGrid.

Following the demo found here, I attempted to set up a table grid.

However, upon viewing the grid in the browser, only the column names are visible without any borders around the columns and rows. Additionally, no data is being displayed even though I have linked it to an XML file containing all the necessary data.

import { Component } from '@angular/core';
import { jqxGridComponent } from 'jqwidgets-framework/jqwidgets-ts/angular_jqxgrid';

@Component({
templateUrl: 'buttons.component.html',
selector: 'my-app',

})
export class ButtonsComponent {

constructor() { }

source: any =
 {
    datatype: "xml",        
    datafields: [
        { name: 'EmployeeNum', type: 'int' },
        { name: 'FullName', type: 'string' },
        { name: 'MarketCenter', type: 'string' },
        { name: 'FunctionTitle', type: 'string' },
        { name: 'HireDate', type: 'date' },
        { name: 'TermDate', type: 'date' }
    ],
    root: "Employees",
    record: "Employ",
    id: 'EmployeeID',

    url: "demos/sampledata/products.xml"
 };

dataAdapter: any = new $.jqx.dataAdapter(this.source);

unitsInStockRenderer: any = (row, columnfield, value, defaulthtml, columnproperties, rowdata) =>
{
    if (value < 20)
    {
        return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + '; color: #ff0000;">' + value + '</span>';
    }
    else
    {
        return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + '; color: #008000;">' + value + '</span>';
    }
};

columns: any[] =
[
    {
        text: 'Employee #', columngroup: 'ProductDetails',
        datafield: 'EmployeeNum', width: 330
    },
    {
        text: 'Name', columngroup: 'ProductDetails',
        datafield: 'FullName', width: 330
    },
    {
        text: 'M/C', columngroup: 'ProductDetails', 
        datafield: 'MarketCenter', width: 330
    },
    {
        text: 'Function', columngroup: 'ProductDetails',
        datafield: 'FunctionTitle', width: 330
    },
    {
        text: 'Hire Date', columngroup: 'ProductDetails',
        datafeild: 'HireDate', width: 330
    },
    {
        text: 'Term Date', columngroup: 'ProductDetails',
        datafeild: 'TermDate', width: 330
    }
]; 

}

The products.xml file contains the necessary table data. Here is an example of a single row:

<Employees>

<Employ EmployeeID="1">
<EmployeeNum>2793</EmployeeNum>
<FullName>Brian Miller</FullName>
<MarketCenter>458-Salt Lake City</MarketCenter>
<FunctionTitle>Controller</FunctionTitle>
<HireDate>10/12/2008</HireDate>
<TermDate>10/12/2008</TermDate>
</Employ>

</Employees>

I would greatly appreciate any assistance with displaying the data within the grid properly and resolving the issue of missing outlines around the columns and grid. Thank you for your help.

Answer №1

All I had to do was place the xml file in the assets directory and it worked without any issues

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring the functionalities of PointerLockControls, incorporating WASD controls, and experimenting with Three.js

Forgive me if this is a beginner question, but I've noticed that in the official three.js examples, the PointerLockControls.js allows for mouse pointer lock and WASD key navigation. I have successfully locked the mouse pointer, but I am having troubl ...

Duplicating a DIV that contains numerous input fields using Jquery Mobile

Just starting out with javascript and running into a little issue that I thought would be easy to solve. Using Jquery Mobile, I want to clone a div and update the IDs of the elements inside. The cloning part works fine, but I'm having trouble with a ...

Typescript and the way it handles responses from REST APIs

Starting off, I must mention that I am relatively new to TypeScript, although I have been a JavaScript developer for quite some time. I am in the process of transitioning my existing JavaScript application to TypeScript. In the current JavaScript app, the ...

What is the best way to retrieve an AJAX response in advance of sending it to a template when utilizing DATAT

Recently, I've been working on integrating log tables into my admin panel using the datatable plugin. Despite setting up an ajax call in my datatable, I'm facing issues with retrieving the response before sending it to the table. Here's a s ...

Creating a stacked chart in Angular using chart.js with JSON array of objects values

I am currently working on implementing a stacked chart using chart.js, and I have encountered some challenges: I am struggling to display currency values in the correct format on the chart (the height of the bar is not visible when passing amounts). How c ...

I am currently working on a website that offers different themes, and I am attempting to update the iframe to reflect the selected theme on the site

I'm feeling lost on how to accomplish this task. Despite my efforts, I have been unable to find a solution so far. Perhaps utilizing javascript might be the key here, yet I am uncertain about integrating it into the existing script that I use for modi ...

Problem with Jquery Focus-Out in Internet Explorer on two textboxes

I am working with two text-boxes, each of which has a Focus-Out event attached to it. $('.ClassofTxtbx1').focusout(function(){ }); $('.ClassofTxtbx2').focusout(function(){ }); Strangely, when I input something in textbox1 and press ta ...

Alerts in online software when there is a modification in the database

I am working on a project to create a web application that needs to display notifications, like the ones you see on Facebook, whenever there is a new update in the database. I could use some assistance with implementing this feature. Are there any third- ...

Refresh ng-repeat array after implementing filter in controller

I am currently facing an issue with updating my table view when changing a variable that filters an array. The filter is applied in the controller based on the values of a specific variable called columnFilter. However, the filter does not reapply to updat ...

AngularUI design pattern for redirecting to a URL post login

In a particular scenario, a user is able to input a URL like: http://localhost:8080/#/component?id=1234 Initially, AngularUI checks if the user has authorization. If not authorized, they are redirected to the login page using the following code: $state. ...

Best way to update a series of IDs with various names using the map function in JavaScript

I currently have a collection of 10 "tags", each with a unique ID format (00:00:00:xx:xx:xx) and translatedID format (TXT). I receive strings containing violating tags that I need to convert from translatedID to ID. Below is the map of values: Map(10) { ...

Exporting data to CSV using Alasql

Alright, so keyResource is fetching data from my C# controller as a List of comma-separated values. When I click the button, the console does display this data. However, when I set the alasql query to keyResource or data, it gives an error saying datasourc ...

Developing a customized bookmarklet that can conceal a div provided that the div includes specific text

I am interested in creating a bookmarklet specifically designed for this page: The aim is to locate divs with the class 'discussionListItem'. These 'discussionListItem' divs have children with the class 'forumLink'. If the te ...

Difficulty with the Testimonials Carousel Javascript

I'm currently attempting to create a Testimonials slider using JavaScript, but I'm facing an issue with the slider not transitioning to the next slide. It functions correctly when on the first or last slide, but fails to move otherwise. I've ...

sending a string of JSON in PHP (including quotes) to an onclick event function

I am faced with the challenge of passing an array of data from PHP to JavaScript for the "onclick" event. The approach I took was to convert the array data into a JSON string which could then be parsed back in the JavaScript function for manipulation. How ...

Comparing two datetime objects with time zone offsets in JavaScript: How to determine if one is greater than or less than the other?

So I'm faced with a situation where I need to compare two dates where the first date is 05.01.2008 6:00 +5:00 and the second date is 05.01.2008 7:00 +5:00 I'm struggling to find a way to convert these datetimeoffsets into a specific forma ...

Background image fixed with scrolling effect

I've been struggling with a parallax effect on my website. After seeing it work smoothly on other websites, I tried to implement it myself but couldn't quite get it right. The background image keeps moving when I scroll the page and I want it to ...

What is the best way to combine a javascript onclick function with php?

I'm currently facing an issue with integrating the onclick function in PHP. Can anyone lend a hand? Here are my code snippets <html> <head> <title></title> <script language="Javascript"> function delete() { val del ...

What is the best way to display a Blender model on a webpage?

After researching different methods for rendering my blender models on my web application, I have chosen to export my model in .gltf format. Here is the code I am currently using: App.js import React, { Suspense } from 'react'; import './Ap ...

Looping through the json resulted in receiving a null value

When working with typescript/javascript, I encountered an issue while trying to fetch the 'statute' from a data object: {_id: "31ad2", x: 21.29, y: -157.81, law: "290-11",....} I attempted to assign data.law to a variable, but received a typeer ...