Hello.
I am facing performance issue with Power Table. My application imports XLS file, parse it and store inside Memory Tag (dataset type, about 35 rows and 20 columns). Power Table is placed inside template. Data property of Power Table is binded bidirectionaly to Custom property of template, which is then bidirectionaly binded to this Tag. Additionally, I am making some cells formatting inside configureCell extension function.
What are my observations:
- Scrolling through the table is very slow, not smooth.
- Scripting inside configureCell doesn’t affect this - I was trying to disable it.
What could be the reason? Maybe Memory Tag is not the best option and i should go with database?
Thank you in advance.
Best regards,
Maciej.
It’s not the dataset it’s the component itself/limitation of the web environment. Try turning on lazy loading with the ‘virtualised’ prop. This definitely speeds up initial loading and scroll speed, but it won’t preload every row anymore
Hello @nminchin . Thank you for the answer, but as I have mantioned in topic, issue is related to Vision Component called Power Table, not Perspective Table
Ah whoops!
For slow scroll speed try this. Not sure if it’s your issue but still useful. Old script… There are things I would change now, but it works. Bonus function to scroll to a row as well
LIBRARY:
shared.components.scrollable
def fixScrollSpeed(scrollableObj):
'''
Description:
Set the scroll 'speed' from extremely slow (default) to useable
Usage:
if event.propertyName in ['componentRunning']:
shared.components.scrollable.fixScrollSpeed(event.source)
'''
components = scrollableObj.getComponents()
# find the embedded JideScrollPane component
for component in components:
if str(type(component)) == "<type 'com.jidesoft.swing.JideScrollPane'>":
scrollPane = component
size = scrollPane.getSize()
# set the scroll increment for the arrows to a fraction of the height of the scrollable panel
scrollPane.getVerticalScrollBar().setUnitIncrement(size.height/4) #scroll amount for wheel and arrows
# set the scroll increment when clicking on the scrollbar track piece to the height of the scrollable panel i.e. move 1 whole 'page' up/down
scrollPane.getVerticalScrollBar().setBlockIncrement(size.height) #scroll amount clicking on scrollbar itself
def scrollTableToPos(tableObj, DataSetFieldName, NewDataSetPosValue):
'''
Description:
Scrolls the table component to the item 1 above the new position.
Arguments:
templateRepeaterObj - the table component
DataSetFieldName - the field name in the templateParams dataset to find the new position value in
NewDataSetPosValue - the field value of the field name to find in the dataset to move to
Revision:
No. Date Author Comment
1.0 2018-11 Nick Minchin Original
'''
#get the template repeater dataset so that we can work out the current index of the maximum
ds = tableObj.data
ds = system.dataset.toPyDataSet(ds)
if len(ds) > 0:
#find the index of the new item from the template repeater dataset
index = 0
for i in range(len(ds)):
if ds[i][DataSetFieldName] == NewDataSetPosValue:
index = i
#Get the full height of the template repeater if it were displayed without scrollbars. Using this we can calculate the relative position of the current step
scrollBar = object.getComponents()[1]
maxHeight = scrollBar.getMaximum()
itemCount = len(ds)
#Calculate the height of each item in the template repeater
itemHeight = (1.0*maxHeight)/itemCount
#Calculate the position of the current step using the item height and the new item's index
newPos = int(itemHeight*(index-1))
# move the scrollbar to the new item's position
scrollBar.setValue(newPos)
Thank you @nminchin, that’s awesome. Works a way better now !
1 Like