Hello,
now I would try the new IG jQuery tools, but I have a problem with the grid. I want to bind a JSON response string from a php service to the grid. But the grid does'nt show any data an add a column that I never defined in the code.
$(function () { $("#grid1").igGrid({ columns: [ { headerText: "ID", key: "id", dataType: "number" }, { headerText: "Description", key: "description", dataType: "string" }, { headerText: "Title", key: "title", dataType: "string" }, ], width: '800px', dataSource: "json_server.php" }); });
Is it possible to bind the return of "json_server.php" to dataSource?
Thanx
Markus
Hi Angel,
the autoGenerateColumns is the solution. But I don't know what happens with the last column. I took your json string and put it back to the client. That's all. nothing more. Just wondering.
Greetz
hey Markus,
hm, not sure why this is happening. Could it be that your response contains more columns than what's in every password object? You could also try setting autoGenerateColumns: false, so that only data that is defined in your columns collection gets bound.
Hope it helps,
Angel
Hey Angel,
you're right. Twice ;)!
Now, with the responseDataKey and a the new format of the response, I've got the right result..nearly.
I still have one column to much.
Did you have any idea?
hi Markus,
if you set the responseDataKey: "passwords" in the options, everything should work fine. but i can see from your response that you are wrapping every object in a separate array, which shouldn't be done. The response should be (I believe):
{"passwords":[{"id":1,"description":"test 1","title":"test 1"},{"id":2,"description":"test 2","title":"test 2"}]}
Thanks again,
thank you for your answer. Here is the response of "json_server.php".
{"passwords":[[{"id":1,"description":"test 1","title":"test 1"}],[{"id":2,"description":"test 2","title":"test 2"}]]}
The data are from a mysql query and via PHP jason_encode generated.