Table Data Issues

When binding a table to a query and selecting a return format of json it returns a very simple object as opposed to what’s eluded to in the manual (i.e. a dictionary with keys value, editable and style). In my attempts to transform the simple json I’ve run into a couple of issues:

  1. If the query returns a null, the value displayed in the table is a string representing the whole dictionary. If I put a value in the db table, it returns what’s expected.

  2. The order of the columns returned doesn’t seem to be that of the query. The following script transforms a returned dataset to a list of dicts. but the column order is different than what’s expected. If I set the return format to json, the column order is correct.

	# convert incoming dataset to a list of dict
	editableCols = []
	ds = value
	colNames = ds.getColumnNames()
	d = []
	for i in range(ds.rowCount):
		rowDict = {}
		for col in colNames:
			editable = False
			if col in editableCols:
				editable = True
			rowDict[col] = {"value":ds.getValueAt(i,col),"editable":editable}
		d.append(rowDict)
	return d

That’s undoubtedly a side effect of python/jython not retaining dictionary entries in the order added. Consider using python’s json module to directly build your object.