Socket
Socket
Sign inDemoInstall

@syncfusion/ej2-data

Package Overview
Dependencies
1
Maintainers
0
Versions
160
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@syncfusion/ej2-data


Version published
Maintainers
0
Created

Package description

What is @syncfusion/ej2-data?

@syncfusion/ej2-data is a data management package that provides a set of utilities for handling data operations such as sorting, filtering, grouping, and querying. It is part of the Syncfusion Essential JS 2 suite and is designed to work seamlessly with other Syncfusion components.

What are @syncfusion/ej2-data's main functionalities?

DataManager

The DataManager feature allows you to manage and manipulate data collections. In this example, a DataManager instance is created with a sample data array, and a query is executed to filter out records where the age is greater than 28.

const { DataManager, Query } = require('@syncfusion/ej2-data');

const data = [
  { id: 1, name: 'John', age: 30 },
  { id: 2, name: 'Jane', age: 25 },
  { id: 3, name: 'Doe', age: 35 }
];

const dataManager = new DataManager(data);
const query = new Query().where('age', 'greaterThan', 28);
const result = dataManager.executeLocal(query);
console.log(result);

Sorting

The Sorting feature allows you to sort data collections based on specified fields. In this example, the data is sorted by the 'name' field in ascending order.

const { DataManager, Query } = require('@syncfusion/ej2-data');

const data = [
  { id: 1, name: 'John', age: 30 },
  { id: 2, name: 'Jane', age: 25 },
  { id: 3, name: 'Doe', age: 35 }
];

const dataManager = new DataManager(data);
const query = new Query().sortBy('name', 'ascending');
const result = dataManager.executeLocal(query);
console.log(result);

Grouping

The Grouping feature allows you to group data collections based on specified fields. In this example, the data is grouped by the 'group' field.

const { DataManager, Query } = require('@syncfusion/ej2-data');

const data = [
  { id: 1, name: 'John', age: 30, group: 'A' },
  { id: 2, name: 'Jane', age: 25, group: 'B' },
  { id: 3, name: 'Doe', age: 35, group: 'A' }
];

const dataManager = new DataManager(data);
const query = new Query().group('group');
const result = dataManager.executeLocal(query);
console.log(result);

Aggregates

The Aggregates feature allows you to perform aggregate operations like sum, average, min, and max on data collections. In this example, the sum of the 'age' field is calculated.

const { DataManager, Query, DataUtil } = require('@syncfusion/ej2-data');

const data = [
  { id: 1, name: 'John', age: 30 },
  { id: 2, name: 'Jane', age: 25 },
  { id: 3, name: 'Doe', age: 35 }
];

const dataManager = new DataManager(data);
const query = new Query().select(['age']);
const result = dataManager.executeLocal(query);
const totalAge = DataUtil.aggregates.sum(result, 'age');
console.log(totalAge);

Other packages similar to @syncfusion/ej2-data

Readme

Source

Overview

@syncfusion/ej2-data is a data management package to perform data operations such as grouping, sorting in client applications. It will act as an abstraction for using local data sources like array of JavaScript objects and remote data sources like web services returning JSON, JSONP, oData or XML.

FAQs

Last updated on 02 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc