1

json 文字列を dojo 拡張データグリッドにフィードするのが非常に困難です。基本的に、生年月日と国籍を持つ人物エンティティがあります。person テーブルの国籍は外部キーです。

私はSpring 3.0を使用しています.json文字列を生成するためのコントローラーロジックは次のとおりです。

uiModel.addAttribute("studentasJSON", new JSONSerializer().serialize(students)); 
//students is a list of Student objects

1 人の生徒の json 文字列を出力すると、次のようになります。

[{"class":"tt.edu.sbcs.model.Student","comment":null, "dateOfBirth":{"class":"java.util.GregorianCalendar","firstDayOfWeek":1,"gregorianChange" :-12219292800000,"lenient":true,"minimalDaysInFirstWeek":1,"time":1069041600000,"timeInMillis":1069041600000,"timeZone":{"DSTSavings":0,"ID":"America/La_Paz"," class":"sun.util.calendar.ZoneInfo","dirty":false,"displayName":"ボリビア時間","lastRuleInstance":null,"rawOffset":-14400000}} ,"ethnicOrigin":null," firstName":"ヤギ","gender":"男性","id":5487,"lastName":"犬","legacyID":null,"maritalStatus":"Single", "nationality":{"class":"tt.edu.sbcs.model.Country","code":"BB","id":1,"name ":"バルバドス","バージョン":262},"nativeLanguage":null,"otherName":"","photo":null,"religion":null,"title":{"class":"tt.edu.sbcs.model.Title","id" :1,"name":"Mr.","version":0},"uniqueIdNumber":null,"version":0}]

ここが複雑なところです。Dojo 拡張グリッドには、 "dateOfBirth":"2003-11-17"が必要です。同様に、"nationality":"Barbados"であり、完全にシリアル化されたオブジェクトではありません。ただし、http://dojotoolkit.org/reference-guide/dojo/store.htmlは、既存のデータストアのクエリについて述べていますが、その使用方法はあまり明確ではありません。誰かアドバイスしてもらえますか?

http://forum.springsource.org/showthread.php?103331-Best-practices-with-Spring-Roo-JSON-and-Ajaxで、dojo 拡張グリッドのクエリ属性を使用して、文字列をクエリする方法を見ました。 . 何かのようなもの

<table dojoType="dojox.grid.DataGrid"
        jsid="grid" id="grid" class="grid" autoHeight="15" noDataMessage="Sorry, there is no data available."
        store="jsonStore" query="{ name: '*' }" rowsPerPage="20" rowSelector="20px">

query 属性の使用についてアドバイスをお願いします。私のシステムには何千ものタプルと任意のエンティティへのリンクがあるため、文字列が生成された後に文字列を操作することは実際的ではありません。

4

0 に答える 0