I have a ListGrid that I am using in “detached” mode. I have setDataSource(myDataSource) and setSaveLocally(true). Then I’m doing using myDataSource.fetchData() followed by ListGrid.setData(DSResponse.getData()). All works fine and the ListGrid gets loaded with existing records.
I then edit some of the existing records and add a new record to the ListGrid. When the user clicks a button I iterate over the list of records, select the ones I want to send to the server and append them as an attribute to the main record being submitted. Here is the list that gets sent to the server.
PoItemDetails:[
{
IOVC:"RED-SCARLET",
IGTINTP:null,
ISBN:null,
ISKU:106369,
IQTY:88,
IGTIN:null,
ISIZ:2,
ICLR:1,
ISEQ:16,
_selection_102:true
},
{
IOVC:"YELLOW",
IGTINTP:"3",
ISBN:null,
ISKU:489,
IQTY:2,
IGTIN:"00000000000111",
ISIZ:2,
ICLR:2,
ISEQ:14,
_selection_102:false
},
{
IOVC:"GREEN",
IGTINTP:null,
ISBN:null,
ISKU:106351,
IQTY:3,
IGTIN:null,
ISIZ:1,
ICLR:3,
ISEQ:15,
_selection_102:false
},
{
IOVC:"BLUE",
IGTINTP:null,
ISBN:null,
ISKU:106377,
IQTY:4,
IGTIN:null,
ISIZ:2,
ICLR:4,
ISEQ:17,
_selection_102:false
},
{
ICLR:82,
ISIZ:1,
IQTY:"5"
}
]
The last record is the one that was added. As you can see, the field IQTY is a String “5” instead of just a number 5 like the other records. Why?
This is the code I’m using to create the list to send to the server.
ArrayList<Record> detailRecs = new ArrayList<Record>();
for (Record detailRec : myListGrid.getRecords()) {
... a complex if statement to decide whether to include the record, then
detailRecs.add(detailRec);
}