View Full Version : Problems with grid and JsonStore - Help needed

20 Aug 2009, 12:57 AM
Hi @ all,

i use ExtJS as an Framework in Groupoffice. There i have the following Problem:

I have two Datagrid. Both get data from an php-File. The functions of both in the php file are 99% identical and both give the right response to the script. While the first Grid shows all what i want, the second one shows only the LAST entry of Json-Response.

Lets say in the response are 10 datasets, the grid display only the last one.

The Json i get back looks like this:

{"success":true,"total":55,"data":[{"crdate":"03.12.2007","indate":"","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von D auf A"},{"crdate":"12.12.2007","indate":"","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von A auf B"},{"crdate":"12.12.2007","indate":"","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von Messe DCKB auf Messe Standardvon 12.12.2007 bis 13.12.2007Bemerkung:Test"},{"crdate":"12.12.2007","indate":"","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von Messe Standard auf Messe DCKBG\u00fcltig vom 12.12.2007 bis 13.12.2007Bemerkung:Noch ein Test"},{"crdate":"12.12.2007","indate":"","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von Messe DCKB auf B"},{"crdate":"18.01.2008","indate":"","cruser":"2","loginuid":"648","action":"98","text":"test"},{"crdate":"18.01.2008","indate":"","cruser":"2","loginuid":"648","action":"98","text":"test"},{"crdate":"21.01.2008","indate":"","cruser":"2","loginuid":"648","action":"1","text":"vorgenommen"},{"crdate":"21.01.2008","indate":"","cruser":"2","loginuid":"648","action":"4","text":"2xFahnen, 10xKugelschreiber"},{"crdate":"21.01.2008","indate":"","cruser":"5","loginuid":"648","action":"0","text":"Konditionsänderung von B auf A"},{"crdate":"21.01.2008","indate":"","cruser":"5","loginuid":"648","action":"0","text":"Konditionsänderung von A auf D"},{"crdate":"21.01.2008","indate":"","cruser":"5","loginuid":"648","action":"0","text":"Konditionsänderung von D auf Messe StandardG\u00fcltig vom 01.01.2009 bis 12.01.2009"},{"crdate":"23.01.2008","indate":"","cruser":"2","loginuid":"648","action":"98","text":"Konditions\u00e4nderung in D:NW EK RSV ge\u00e4ndert von 5,99 auf 5,90GW EK RSV ge\u00e4ndert von 5,99 auf 5,90NW LL EK RSV ge\u00e4ndert von 5,99 auf 5,90GW LL EK RSV ge\u00e4ndert von 5,99 auf 5,90"},{"crdate":"23.01.2008","indate":"","cruser":"2","loginuid":"648","action":"98","text":"Konditions\u00e4nderung in D:NW MEK RSV ge\u00e4ndert von 5,49 auf 5,40"},{"crdate":"24.01.2008","indate":"","cruser":"2","loginuid":"648","action":"98","text":"Konditions\u00e4nderung in D:NW EK RSV : ge\u00e4ndert von 5,90 auf 5,99NW MEK RSV : ge\u00e4ndert von 5,40 auf 5,49GW LL RSVA : ge\u00e4ndert von 170 auf 270"},{"crdate":"24.01.2008","indate":"","cruser":"2","loginuid":"648","action":"3","text":"Wurde nix besprochen"},{"crdate":"24.01.2008","indate":"","cruser":"2","loginuid":"648","action":"98","text":"Konditions\u00e4nderung in D:NW EK RSV : ge\u00e4ndert von 5,99 auf 5,98NW MEK RSV : ge\u00e4ndert von 5,49 auf 5,48NW RSVA : ge\u00e4ndert von 260 auf 360"},{"crdate":"30.01.2008","indate":"","cruser":"2","loginuid":"648","action":"0","text":"Konditionsänderung von D auf B"},{"crdate":"28.02.2008","indate":"28.02.2008","cruser":"2","loginuid":"648","action":"99","text":"Test"},{"crdate":"13.03.2008","indate":"13.03.2008","cruser":"2","loginuid":"648","action":"99","text":"noch ein test"},{"crdate":"13.03.2008","indate":"13.03.2008","cruser":"2","loginuid":"648","action":"6","text":"Test"},{"crdate":"25.03.2008","indate":"25.03.2008","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von B auf A"},{"crdate":"27.03.2008","indate":"27.03.2008","cruser":"2","loginuid":"648","action":"6","text":"test"},{"crdate":"20.05.2008","indate":"20.05.2008","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von A auf C"},{"crdate":"21.05.2008","indate":"20.05.2008","cruser":"2","loginuid":"648","action":"98","text":"Konditions\u00e4nderung in C:NW CC RSV : ge\u00e4ndert von 5,98 auf 6,5"},{"crdate":"21.05.2008","indate":"20.05.2008","cruser":"2","loginuid":"648","action":"98","text":"Konditions\u00e4nderung in C:NW CC RSV : ge\u00e4ndert von 5,98 auf 6,5"},{"crdate":"21.05.2008","indate":"21.05.2008","cruser":"2","loginuid":"648","action":"98","text":"Konditions\u00e4nderung in C:NW ZA : ge\u00e4ndert von 1 auf 7NW RSVA : ge\u00e4ndert von 360 auf 29"},{"crdate":"22.05.2008","indate":"21.05.2008","cruser":"2","loginuid":"648","action":"98","text":"Konditions\u00e4nderung in C:NW RSVA : ge\u00e4ndert von 29 auf 23"},{"crdate":"09.06.2008","indate":"09.06.2008","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von C auf D"},{"crdate":"09.06.2008","indate":"09.06.2008","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von D auf C"}]}

And displayed is only the last:

{"crdate":"09.06.2008","indate":"09.06.2008","cruser":"2","loginuid":"648","action":"98","text":"Konditionsänderung von D auf C"}

If i swap the call of functions, means grid two get the data from grid one, all seems perfect.

I think the data above maybe corrupt?

Thanx for help in advance


20 Aug 2009, 1:28 AM
It's hard to tell from just the json what goes wrong here, jsonlint parses it as correct (please wrap it in [ code ] - [ /code ] tags in your postings). One obvious thing is the mix of escaped unicode and umlauts in the text (Konditions\00e4nderung vs Konditionsänderung).

20 Aug 2009, 1:50 AM
Thanx for reply,

the "\00e4" comes from php function json_encode. I have tryed to transform all umlauts to entities, but it doesnt help.

The count displays me the correct count of entrys (in this case 55), the gridfooter where the paging buttons are tells me "Show Entrys 1 - 1 of 55" and gives me the selection of two pages, which in this case is ok. But every Page only display one entry...



20 Aug 2009, 6:21 AM
You could probably figure out what is wrong by stepping through the debugger or examining what is different between grid 1 and 2. Are you defining an idProperty (or id) on your reader?

Taking a wild guess based on limited information you have shared, idProperty is used as a unique identifier. It looks like all the records have the same value for "cruser" and "loginuid", so if either of those is the idProperty then you would get one record.

If those don't help, post some code. Be sure to use [ code ] [ / code ] tags and the preview button to make sure any code you post is nicely formatted and readable.

20 Aug 2009, 6:31 AM
Taking a wild guess based on limited information you have shared, idProperty is used as a unique identifier. It looks like all the records have the same value for "cruser" and "loginuid", so if either of those is the idProperty then you would get one record.

Thank you... thats really helps and now all is fine. I dont have´nt in mind that the id is unique... but if i read your post its really clearly for me...