phpgrid and json

Questionsphpgrid and json
Robby asked 5 years ago

Hi gentlemen,

I'm using phpgrid with MySQL database without any problem.
I want to use it with a json request.

The target is to build the answer requesting in differents database.
The to return answer in JSON.

Do you know if it's possible and if someone have an example?

Thanks for your help.

Regards.

LGN

2 Answers
David answered 5 years ago

Hi LGN,

I think a solution is format your JSON like this:

{
"1":[{"id":"1","created":"2010-03-19 ","name":"peter"}],
"2":[{"id":"2","created":"2010-03-19 ","name":"john"}],
"3":[{"id":"3","created":"2010-03-19 ","name":"michael"}]
}

In PHP use $data = json_decode($json_response) to get a multidimensional array. Then assign it to jqgrid $grid->table = $data;

It is a possible solution.

Regards!

Abu Ghufran answered 5 years ago

I would recommend to review the php array based grid implementation.
You can fetch data from other databases, and make a php array, which will be feeded to phpgrid as table source.

Refer demos/loading/php-arrray demo.

Your Answer

11 + 17 =

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 / 5. Vote count:

As you found this post useful...

Follow us on social media!

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

Let us improve this post!