EDIT: implemented Carl’s suggestion from the next post
I have a table component that I’m filling with lot’s of data and it locks the application for 10’s of seconds. If fact the spinner thingy in the top right that shows that a screen is loading is also locked. The screen doesn’t display because it’s waiting for the table to fill before it can be drawn.
First I unbound the data property on the table. (It called a script to get the data).
Then I added a refresh button and unbound the other components on the screen that would cause the table to be refreshed. In this case I had a number of filters that the user could use to filter the data. Check boxes, text inputs, etc. Every time the user changed something the table would reload. Now the user sets up their filters and then clicks the refresh button.
For the mouseClicked event the button, I added this code:
soeWindow = system.gui.getWindow(‘SOELog’)
s = soeWindow.rootContainer.getComponent(‘SOEs’)
table = s.getComponent(‘SOETable’)
if newcursor == ‘Wait’:
This changes the cursor for the table so the user knows something is happening.
I don’t call changeCursor directly because invokeLater and invokeAsynchronous take the name of a function and no parameters are allowed. (In this case I could have but at one time this call was an invoke call)
... #do major db stuff to collect and process gobs of data ... soeWindow = system.gui.getWindow('SOELog') table = soeWindow.rootContainer.getComponent('SOEs').getComponent('SOETable') newDataset = system.dataset.toDataSet(columns, rowData) def setData(table=table, newDataset=newDataset): table.data = newDataset system.util.invokeLater(setData) system.util.invokeLater(app.history.defaultCursor)
These last few lines directly set the data property for the table.
When I first wrote this function, it was bound to the data property. The last line was:
return system.dataset.toDataSet(columns, rowData)
Now that the table is no longer bound, I had it to change to what you see above.
Note the last line. This returns the cursor to the default:
There was one more step. The table now loads only when the user clicks the Refresh button. I wanted the table to load when the screen was opened. To do this I added the following to the internalFrameOpened event for the window:
#change cursor to spinning and load data
Now I have a windows that opens instantly, fills up the table when the data has been processed, and lets the user know that something is happening.