Hey all,
Have you noticed that if you use an embedded view, such as a text field or drop down, to select a table row it takes one click? But, if you use a numeric field you have to double-click?
Is there a way to make a single-click work on this embedded component?
Edit: the video does not really show the double-clicks, but that is what happens when the row is selected with the mouse over the numeric field.
I know in perspective if you have a numeric entry field mode property set as 'protected' it takes 2 clicks, but if you change it to direct, it only takes 1. Might need changed if you are using a numeric entry field component as part of that embedded view.
Edit: I just realized the video looked like you were using a table component & it might need to have single click option selected for allowEditOn for the numeric cells. The other options are long press and double click.
Well the numeric field is already direct
and after changing the allowEditOn
to single-click still no dice. I just tried changing the table.columns[0].editable
to true
...didn't work either.
This one:
Looking through the props, not sure what else to check, if it's possible.
Only other thing I could think of would have been if there was a cell specific setting on the numeric field columns that would be interfering with the row selection settings for the table, assuming everything else is the same between the numerics vs the text fields and drop downs.
The default table component didn't look to have that issue, but I think it uses labels for the numeric entry fields, so it might just be an issue with the numeric component.
How was this table being built?
From this thread here, the YT video by Daniel Talbot.
Basically, it's scripted from a dataset. The props.data
is rebuilt via scripting as well as the data.columns
. I think the relevant code is all there.
I took a look at a "normal" table, and there is no problem selecting a row with numbers or letters in it.
If you're using a script to generate the table's columns objects like I do in the video, make sure to set colobject['editable'] = True in the script (setColumns) for each column you want editable. Each time that script runs it replaces whatever you have manually set in your table's columns objects.
If you're not using an embedded view to edit the cell, and your column object has editable set to True, then table.props.cells.allowEditOn will let you switch between single and double click to begin editing the cell. To get the edit to commit and update the dataset, you will need to add an onEditCellCommit event script to your table. Your script may look different depending on how your data is structured.
1 Like
Right. In your video, you do not use numeric entry fields, so it does not show that you still have to double-click to activate the row selection.
This
does not affect how many clicks it takes to get to the center of a Tootsie Roll Lollipop , I mean how many clicks it takes to activate the row selection.
What it does change is how the numeric value is displayed/edited on a double-click. I can't record it ATM, but I enabled this on two of the numeric fields and tested it.
Can I add on an additional question regarding the script for saving the new row(s) added to the table?
I am using your code for the Save button here, with some modifications, see the insert
comment.
t_stamp = system.date.now()
table = self.getSibling("Table_0")
data = table.props.data
columns = table.props.columns
txID = system.db.beginTransaction(database="", timeout=5000)
try:
for row in data:
req_id = row['ReqID']['value']
deleteMe = row['deleteMe']
updateMe = row['updateMe']
if deleteMe:
args = [t_stamp, req_id]
query = """
UPDATE rfp.Item_Request
SET
DeleteRow = 1,
UpdatedAt = ?
WHERE ReqID = ?
"""
system.db.runPrepUpdate(query, args, tx=txID)
# insert
elif req_id is None:
temp = []
args = []
for col in columns:
if col.field == 'Description':
pass
elif col.field == 'PartNumber':
pass
elif col.field == 'ContainerID':
pass
elif col.field == 'ReqID':
pass
else:
args.append(row['ReqID'])
args.append(row[col.field]['value'])
temp.append(col.field)
columnString = ",".join(temp)
valueString = ",".join(["?" for col in temp])
query = """
INSERT INTO rfp.Item_Request
({}) VALUES ({})
""".format(columnString, valueString)
system.db.runPrepUpdate(query, args, tx=txID)
My question is, for the field/column "ReqID", I would like to add my own value to this, which will be coming from a parameter.
The line
else:
args.append(row['ReqID'])
is where I am stuck. args
is a list of objects, so I need to append the field ReqID
and a value. Do I just add a number at the end, like: args.append(row['ReqID']100)
?
# insert
elif req_id is None:
temp = ['ReqID']
args = [newReqID]
for col in columns:
if col.field == 'Description':
pass
elif col.field == 'PartNumber':
pass
elif col.field == 'ContainerID':
pass
elif col.field == 'ReqID':
pass
else:
args.append(row[col.field]['value'])
temp.append(col.field)
columnString = ",".join(temp)
valueString = ",".join(["?" for col in temp])
query = """
INSERT INTO rfp.Item_Request
({}) VALUES ({})
""".format(columnString, valueString)
system.db.runPrepUpdate(query, args, tx=txID)
I think this is what you're looking for. Initialize temp with the name of the column, "ReqID", and initialize args with the value you want to use.
1 Like