saving json

Questionssaving json
Kyu Kim asked 2 years ago

Hi,

This is  example of loading json from the forum.

You can fetch this data from database using php-mysql standard functions and convert it in php array. This array can be supplied as datasource for grid.

To load grid from array, you can review demos/loading/load-array.php

Demo: https://gist.github.com/gridphp/af7ce29b851a125ad0af787ddd4d1dba

I have postgres database with id,json as database field containing json data like the sample above.
How can I save it using the rest events?
Or is there simple way to edit the json on the grid. (Current it does not let you)

Q

2 Answers
Kyu answered 2 years ago

Search google found this:
https://phpgrid.com/example/json-data-source/
Save local array back to database

I think same thing can be done with grid php.
Having sample will be great!

Abu Ghufran Staff answered 2 years ago

Yes, You can refer this demo:
Demo: https://gist.github.com/gridphp/af7ce29b851a125ad0af787ddd4d1dba

Most likely you need to first fetch the data from database using some query: e.g.

$g = new jqgrid(..);
$rs = $g->get_all("SELECT id,json FROM tab");

and then iterate on $rs and load json to data array of grid.

To insert, update, delete these values, Please refer callback events:

https://www.gridphp.com/docs/grid-events/

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

8 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?