But I failed to download the filtered data [props.filter.results.data]of the table using a button .
Can you help me in this as I find the filtered data is not a dataset so how to fix my code .
# implement your handler here
fileName = 'HighBay Main Search '+self.props.filter.text+'.xls'
props.filter.results.data is a dictionary that should be converted to dataset.
Blockquote
myList =
for key in value:
Header=key.keys()
myList.append(key.values())
myorder = [5,6, 2,1, 3, 0,4]
myList = [[sublst[i] for i in myorder] for sublst in myList]
Header = [Header[i] for i in myorder]
You can actually use system.dataset.filterColumns() to reorder the columns of a dataset.
header = []
data = []
for key in value:
if not header:
header = key.keys()
data.append(key.values())
return system.dataset.filterColumns(system.dataset.toDataSet(header,data),[5,6,2,1,3,0,4])
Also, be carful with scope. In your script the list Header is only defined inside of the for loop. If for some reason value is None or empty, then your script will result in an error.
Also, since the column names should always match, there is no need to get the column names more than once.