
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@genesislcap/grid-pro
Advanced tools
The @genesislcap/grid-pro
package provides a collection of grid-related components and utilities for Genesis applications.
For more detailed information on API and configurations, please refer to the API documentation in the docs/api
directory.
src/
: Source code for the package, including cell-editors, cell-renderers, datasources and utility functions.
cell/
: The Grid Pro Cell element and templatecell-editors/
: predefined custom cell-editors for common data types including date
, number
, string
, select
, multiselect
cell-renderers/
: predefined custom cell-renderers.column/
for a given column.datasource/
: Genesis Datasource elements, responsible for fetching data for the Grid Pro element (multiple implementations available, for both client-side and server-side row models).external/
: External assets such as fonts and styles for themes.state-persistence/
: Classes related to saving and restoring grid state.tooltips/
: Tooltip for errors that happen while syncing data with server after inline editing.utils/
: Utility functions.To enable this module in your application, follow the steps below.
@genesislcap/grid-pro
as a dependency in your package.json
file. Whenever you change the dependencies of your project, ensure you run the $ npm run bootstrap
command again. You can find more information in the package.json basics page.{
"dependencies": {
"@genesislcap/grid-pro": "latest"
},
}
Make sure the required grid components are registered with your design system. Depending on how the app was created this might have been setup for you automatically (genx cli / create). The design system name might vary (you can create a custom one for your app), using rapid in this example.
import { provideDesignSystem, baseComponents } from '@genesislcap/rapid-design-system';
import { rapidGridComponents } from '@genesislcap/rapid-grid-pro';
provideDesignSystem().register(baseComponents, rapidGridComponents);
There are many attributes that can be set on a datasource component.
Some resource related attributes are DATASERVER
or REQUEST_SERVER
specific while others can be used with both.
Name | Type | Default | Description |
---|---|---|---|
resource-name | string | - | The name of the target Data Server query or Request Server requestReply . |
is-snapshot | boolean | false | Request a snapshot from the server. |
criteria | string | - | Clients can send a Groovy expression to perform filters on the query server; these remain active for the life of the subscription. |
max-rows | number | - | Maximum number of rows to be returned as part of the initial message, and as part of any additional MORE_ROWS messages. This will not affect the number of rows displayed |
view-number | number | - | The desired view/page you want data from. |
Name | Type | Default | Description |
---|---|---|---|
fields | string | - | This optional parameter allows you to select a subset of fields from the query if the client is not interested in receiving all of them. |
max-view | number | - | Maximum number of rows to track as part of a client "view" |
moving-view | boolean | false | If true, when the maximum number of rows defined in max-view is reached, the Data Server will start discarding the oldest rows (in terms of timestamp) and sending newer rows. If false, the updates in the server will be sent to the front end regardless of order. Note that this will only update the UI; no changes will be performed in the database. |
order-by | string | - | This option can be used to select a Data Server index (defined in the Data Server query ), which is especially useful if you want the data to be sorted in a specific way. By default, Data Server rows are returned in order of creation (from oldest database record to newest). |
reverse | boolean | false | This option changes the Data Server index iteration. For example, if you are using the default index, the query will return rows in order from the newest database records to the oldest. |
Name | Type | Default | Description |
---|---|---|---|
disable-polling | boolean | false | This option disables polling if set to true (data updates for the grid will not be fetched automatically). |
polling-interval | number | - | This option enables you to set a custom polling frequency (in milliseconds) for a Request Server resource. Note that this option only works with Request Server resources; if your resource is a Data Server query , your grid is updated in real time. |
request | string | - | Similar to fields but for Request Server scenarios. This optional parameter enables you to specify request fields, which can include wildcards. |
request-auto-setup | boolean | false | This option, if set to true, will automatically set up the request based on the datasources's metadata. |
There are additional attributes that can affect the behavior of a datasource component.
<grid-pro-client-side-datasource>
Name | Type | Default | Description |
---|---|---|---|
restart-on-reconnection | boolean | false | This option, if set to true, will force the resource data to be reloaded upon a reconnection event. |
keep-col-defs-on-clear-row-data | boolean | false | This option, if set to true, will retain column definitions upon a restart or clearRowData event. |
<grid-pro-server-side-datasource>
Name | Type | Default | Description |
---|---|---|---|
pagination | boolean | false | This option enables pagination if set to true, otherwise the behavior will be infinite-scroll. |
zero-based-view-number | boolean | false | This option, if set to true, will make the starting VIEW_NUMBER zero-based (starting from 0 instead of 1). |
live-updates | boolean | false | This option enables live updates for the grid if set to true. |
More details about our datasource implementations here.
import { ColDef, GridOptions } from '@ag-grid-community/core';
import { GridPro } from '@genesislcap/grid-pro';
import { customElement, DOM, GenesisElement, html, observable, ref } from '@genesislcap/web-core';
@customElement({
name: 'simple-grid-example',
template: html`
<rapid-grid-pro ${ref('grid')}></rapid-grid-pro>
`,
})
export class SimpleGridExample extends GenesisElement {
@observable
public grid: GridPro;
private columnDefs: ColDef[] = [
{ headerName: '#', colId: 'rowNum', valueGetter: 'node.id', width: 80, pinned: 'left' },
{ headerName: 'Athlete', field: 'athlete', width: 150, pinned: 'left' },
{ headerName: 'Age', field: 'age', width: 90, pinned: 'left' },
{ headerName: 'Country', field: 'country', width: 150 },
{ headerName: 'Year', field: 'year', width: 90 },
{
headerName: 'Date',
field: 'date',
width: 110,
filter: 'agDateColumnFilter',
filterParams: {
buttons: ['apply', 'reset'],
browserDatePicker: true,
comparator: (filterLocalDateAtMidnight, cellValue) => {
// Handling '29/08/2004' date format - adjust as need to match your date format
// https://www.ag-grid.com/javascript-data-grid/filter-date/
const dateAsString = cellValue;
if (dateAsString == null) return -1;
const dateParts = dateAsString.split('/');
const cellDate = new Date(
Number(dateParts[2]),
Number(dateParts[1]) - 1,
Number(dateParts[0]),
);
if (filterLocalDateAtMidnight.getTime() === cellDate.getTime()) {
return 0;
}
if (cellDate < filterLocalDateAtMidnight) {
return -1;
}
if (cellDate > filterLocalDateAtMidnight) {
return 1;
}
return 0;
},
},
},
{ headerName: 'Sport', field: 'sport', width: 150, editable: true },
{ headerName: 'Gold', field: 'gold', width: 100 },
{ headerName: 'Silver', field: 'silver', width: 100 },
{ headerName: 'Bronze', field: 'bronze', width: 100 },
{ headerName: 'Total', field: 'total', width: 100, pinned: 'right' },
];
private rowData = [
{
athlete: 'Michael Phelps',
age: 27,
country: 'United States',
year: 2012,
date: '12/08/2012',
sport: 'Swimming',
gold: 4,
silver: 2,
bronze: 0,
total: 6,
},
{
athlete: 'Natalie Coughlin',
age: 25,
country: 'United States',
year: 2008,
date: '24/08/2008',
sport: 'Swimming',
gold: 1,
silver: 2,
bronze: 3,
total: 6,
isActionDisabled: true,
},
// ...
];
private gridOptions: GridOptions = {
defaultColDef: {
resizable: true,
filter: true,
},
columnDefs: this.columnDefs,
rowData: this.rowData,
};
connectedCallback() {
super.connectedCallback();
DOM.queueUpdate(() => {
this.grid.gridOptions = this.gridOptions;
});
}
}
@customElement({
name: 'connected-grid-client-side-example',
template: html`
<rapid-grid-pro enable-row-flashing enable-cell-flashing>
<grid-pro-client-side-datasource
resource-name="ALL_TRADES"
criteria="INSTRUMENT_ID == 'TSLA'"
></grid-pro-client-side-datasource>
</rapid-grid-pro>
`,
})
export class ConnectedGridClientSideExample extends GenesisElement {}
Note: if pagination is set to false the grid will be in infinite scroll mode.
@customElement({
name: 'connected-grid-server-side-example',
template: html`
<rapid-grid-pro enable-row-flashing enable-cell-flashing>
<grid-pro-server-side-datasource
resource-name="ALL_TRADES"
criteria="INSTRUMENT_ID == 'TSLA'"
></grid-pro-server-side-datasource>
</rapid-grid-pro>
`,
})
export class ConnectedGridServerSideExample extends GenesisElement {}
This folder contains implementations of Genesis datasource
components, responsible for fetching data for Genesis Grid Pro components.
This document outlines the available features of our two “Grid Pro” datasources: <grid-pro-client-side-datasource>
and <grid-pro-server-side-datasource>
.
DATASERVER
and REQUEST_SERVER
resources.sortable
we’ll check if it’s really ok to do that + warn in the logs about it + try to mention other available indexes.. if any at all.CRITERIA_MATCH
paramORDERY_BY
paramWe support all of the AG’s Row Models. More on JavaScript Grid: Row Models | AG Grid (ag-grid.com).
In the table below you can find a complete “feature list” of all the possibilities of client/server-side row models (and others too.. that can be manually enabled/integrated but we don’t expose any components for those yet).
It’s important to note that any client app can implement the other Row Models to their own needs. Our Grid Pro component is not tied to the datasource, it’s the opossite.. so datasources can be as specialized/customized as possible.
Infinite
and Viewport
row models are also supported but not offered "out of the box" (devs will have to create their own component).
Feature | Client-Side | Server-Side | Notes |
---|---|---|---|
All Data in Client | ✓ | ✗ | Free |
Fetch Data as User Scrolls | ✗ | ✓ | Free |
Row Sorting | (client) | (client OR server) our component is server-only | Free |
Row Filtering | (client) | (client OR server) our component is server-only | Free |
Quick Filter | ✓ | ✓ | Free |
Floating Filters | ✓ | ✓ | Free |
Dynamic Row Height | ✓ | ✓ | Free |
Row Grouping | (client) | (server) | Paid (Enterprise) |
Row Pivoting | (client) | (server) | Paid (Enterprise) |
Lazy Loading Row Groups | ✗ | ✓ | Paid (Enterprise) |
Value Aggregation | (client) | (server) | Paid (Enterprise) |
Row Selection | ✓ | ✓ | Free |
Specify Selectable Rows | ✓ | ✓ | Free |
Header Checkbox Selection | ✓ | ✓ | Free |
Range Selection | ✓ | ✓ | Free |
Column Spanning | ✓ | ✓ | Free |
Column Pinning | ✓ | ✓ | Free |
Row Pinning | ✓ | ✓ | Free |
Pagination | ✓ | ✓ | Free |
Custom Filters | ✓ | ✓ | Free |
Cell Editors | ✓ | ✓ | Free |
Cell Renderers | ✓ | ✓ | Free |
Value Getter | ✓ | ✓ | Free |
Value Setter | ✓ | ✓ | Free |
Value Formatter | ✓ | ✓ | Free |
Value Parser | ✓ | ✓ | Free |
Full Width Rows | ✓ | ✓ | Free |
CSV Export | ✓ | (data on screen) | Free |
Excel Export | ✓ | (data on screen) | Paid (Enterprise) |
Clipboard Copy & Paste | ✓ | ✓ | Free |
Update via Transaction | ✓ | ✓ | Free |
Update via Async Transactions | ✓ | ✓ | Free |
DOM Virtualisation is a powerful technique that enhances the performance of grid components by only rendering the rows and columns that are currently visible in the viewport. This approach significantly reduces the memory footprint and improves the rendering speed, enabling all of our “grid components” to handle larger datasets more efficiently.
For more details, visit the AG Grid DOM Virtualisation documentation (also available in Tabulator Virtual DOM)
Pagination is another effective technique to improve performance in AG Grid by breaking down large datasets into smaller, manageable chunks or pages. This allows the grid to load and render only a subset of data at a time, significantly reducing the load on the client.
By leveraging both DOM Virtualisation and Pagination, our “grid components” can efficiently manage and display larger datasets on the client-side. Here’s how these techniques work together:
Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact Genesis Global for more details.
Genesis low-code platform
FAQs
Genesis Foundation AG Grid
The npm package @genesislcap/grid-pro receives a total of 1,766 weekly downloads. As such, @genesislcap/grid-pro popularity was classified as popular.
We found that @genesislcap/grid-pro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.