phpgrid and json

Questionsphpgrid and json
Robby asked 10 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 10 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 10 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

5 + 16 =

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?