Hello! I have been looking through all Tree examples in the showcase page. However, they do not match what I am looking for. From what I can tell, they all have nodes that are of the same "object", like people, or folders. My data comes in as a JSON which consists of a list with many "machines". The showcase menu itself would be more like what I am looking at, which the source code does not seem available to.
Simplified JSON:
{
"machines": [
{
"id": "123",
"name": "name",
"country": "123",
"station": "123",
"terminal": "123",
"status": "online"
... (other random data)
},]}
What would be the best approach to this? Would a single DS file some how be able to solve this or do I need to modify the JSON and create another that holds the categories?
This is what I've got in the DS at the moment which obviously is not enough.
Any insight would be very appreciated, thanks!
Best regards, Bobby
Simplified JSON:
{
"machines": [
{
"id": "123",
"name": "name",
"country": "123",
"station": "123",
"terminal": "123",
"status": "online"
... (other random data)
},]}
What would be the best approach to this? Would a single DS file some how be able to solve this or do I need to modify the JSON and create another that holds the categories?
This is what I've got in the DS at the moment which obviously is not enough.
Code:
public static KCollectionDS [I]instance [/I]= null; public static KCollectionDS getInstance() { if ([I]instance [/I]== null) { [I]instance [/I]= new KCollectionDS("kCollectionDS_JSON"); } return [I]instance[/I]; } public KCollectionDS(String id) { setID(id); setDataFormat(DSDataFormat.[I]JSON[/I]); DataSourceTextField countryField = new DataSourceTextField("country_name", "Country"); DataSourceTextField stationField = new DataSourceTextField("station_name", "Station"); DataSourceTextField terminalField = new DataSourceTextField("terminal","Terminal"); DataSourceTextField machineField = new DataSourceTextField("computer_name", "Machine"); machineField.setPrimaryKey(true); machineField.setRequired(true); setFields(countryField, stationField, terminalField, machineField); setDataURL("ksjson.json"); }
Best regards, Bobby
Comment