Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
fl0cke committed Aug 24, 2023
1 parent 2f8d976 commit 539b175
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) Jan Beckr <[email protected]>
Copyright (c) Jan Becker <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ However, here are some examples that you may use as a starting point four your o

### Creating a DataSource

In order to use the server-side row model, you must create a data source. Here is an exemplary implementation of such one:

```typescript
function makeDataSource<T>(
url: string,
Expand Down Expand Up @@ -215,6 +217,8 @@ However, here are some examples that you may use as a starting point four your o

### Triggering a server-side export

Server-side exports are not implemented in AG Grid by default. However you can create a custom context menu or add a button somewhere that triggers the server-side export. The handler function may look something like this:

```typescript
async function exportServerSide(grid: GridApi, format: 'excel' | 'csv' | 'tsv', onlySelected: boolean) {
// using a private api here to oget the ssrm parameters
Expand Down Expand Up @@ -246,13 +250,14 @@ async function exportServerSide(grid: GridApi, format: 'excel' | 'csv' | 'tsv',

### Tracking selection state

If you want to use server-side selects, you must track the current selection and filter state of the grid:

```typescript

// use the selection in any batch requests to the server
let selection: AgGridSelection

function onSelectionChanged(event: SelectionChangedEvent) {

if (event.api.getModel().getType() !== 'serverSide') {
throw new Error('Only the serverSide row model is supported.')
}
Expand All @@ -262,7 +267,7 @@ function onSelectionChanged(event: SelectionChangedEvent) {
rowModel: 'serverSide',
selectAll: selectionState.selectAll,
toggledNodes: selectionState.toggledNodes,
filterModel: api.getFilterModel()
filterModel: event.api.getFilterModel()
}
}

Expand Down

0 comments on commit 539b175

Please sign in to comment.