No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Converting ListGrid RecordList To JSON String

    Hi Isomorphic,

    Is there a way to get a JSON String representation of a RecordList representing the the record data in the RecordList?

    We have tried using JSONEncoder on the grid.getDataAsRecordList() but it always comes back as {} and doesn't include any record data from the RecordList.

    We also tried with a Tree.


    Hi stonebranch2,

    not 100% sure, but I think RecordList only applies if you set the Records yourself. If you use a DataSource you will have to deal with the ListGrid's ResultSet.
    Do you set the Records yourself?

    Best regards


      JSONEncoder is the right way, but what you are probably doing is passing it directly, which is a ResultSet, so the encoder does what it does whenever it's passed a class: just returns an empty object.

      Instead, get the data from the ResultSet using, for example, getRange() to get whatever subset you want to output.

      Another possibility would be passing the data to the JSONEncoder before it's actually been loaded - you would want to wait for DataArrived.

      If this doesn't seem to be working, please show the code you're using to pass data to JSONEncoder and we can comment on what may be wrong.


        Thank you both, we got it going with your clarifications.