Power Table Value Accept

Hello-

I’m using a power table on a data entry form where users input data in a couple of columns, then hit a submit button and it moves it to SQL. I’m having an issue with some of my users where they enter in a value into the last cell of the form, and they do not hit enter or click into any other component. So from the user’s perspective it appears the value is correct. But then when they click submit it submits a 0 or Null value because they power table value change never actually happened.

Is there a way to force this value “accept” on the submit button or on the mouseExited function or something? I tried changing Selected Column and Selected Row to -1 on mouseExited, but this did not solve the problem (cell still shows 123 but real value is Null). Or any tricky ways I can get around this without just giving the user an error for submitting a Null value?

Two possible solutions:

event.source.parent.getComponent('Power Table').getTable().putClientProperty("terminateEditOnFocusLost", True)
table = event.source.parent.getComponent('Power Table').getTable()

if table.isEditing():
	table.getCellEditor().stopCellEditing()

This worked great, thank you! How would I have known about this component property? I didn’t find anything on this when searching the documentation.

I imagine this is something I would want to put in the initialize extension function on each table? Or do you think it would be better from a different extension function or from the submit button? Or its all the same?

Hi Robert,

PGriffith probably found the solution at the following link on the Internet: https://tips4java.wordpress.com/2008/12/12/table-stop-editing/

PGriffith’s code gets Jide’s table which subclasses Swing’s JTable. You can see the available client properties provided by Swing at this link: http://www.java2s.com/Tutorial/Java/0240__Swing/SwingsClientPropertiesSummaryTable.htm

I don’t think it matters where you put the code. I would put it in the initialize extension function.

1 Like