Skip to content

Commit e5b3111

Browse files
committed
doc JSON Response
1 parent cbb74e8 commit e5b3111

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

Resources/doc/apiSupport.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Api support - JSON Response
2+
3+
Jeżeli potrzebujesz możesz otrzemać rezultat w formacie JSON, zostanie zwrócony obiekt
4+
z polami:
5+
6+
`formKey` - klucz którego powinieneś użyć jeżeli będziesz chciał filtrować wynik
7+
8+
`totalPages` - Ostatnia dostępna strona
9+
10+
`currnetPage` - Aktualnie pobrana strona
11+
12+
`data` - Tablica zawierająca obiekty zgodne z konfiguracją grida
13+
14+
### Przykład
15+
16+
Konfiguracja pochodzi z [Przykład wykorzystania](baseExample.md) zmieni się tylko akcja w kontrolerze
17+
18+
19+
```php
20+
<?php
21+
22+
namespace AppBundle\Controller;
23+
24+
use AppBundle\Grid\ExampleGrid;
25+
use AppBundle\Grid\ExampleAnotherGrid;
26+
use Makoso\DatagridBundle\Grid\Grid;
27+
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
28+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
29+
30+
class DefaultController extends Controller
31+
{
32+
/**
33+
* @Route("/", name="homepage")
34+
*/
35+
public function indexAction(Grid $grid)
36+
{
37+
return $grid->configure(new VirtualEntityGrid())->getJsonResponse();
38+
}
39+
}
40+
41+
```
42+
43+
Gotowe!

Resources/doc/baseExample.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Przykład wykorzystania
1+
# Przykład wykorzystania
22

33
Załóżmy że masz entity podobne do tego:
44

Resources/doc/summary.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
* [Instalacja](install.md)
44
* [Przykład wykorzystania](baseExample.md)
5-
* [MultipleGrid](multipleGrid.md)
5+
* [MultipleGrid](multipleGrid.md)
6+
* [Api support (JSONResponse)](apiSupport.md)

0 commit comments

Comments
 (0)