Hello,
I´m trying to find a way to choose multiple checkboxes from a table column. Now I can only choose one.
Hello,
I´m trying to find a way to choose multiple checkboxes from a table column. Now I can only choose one.
What about sharing how this table is populated so folks can help without guessing?
For example, if you are trying to select MAD-FINDO and MAD-FINNU and that isn't working, then that isn't the table as much as how the table data is being presented.
If you're trying to do something like "shift-click" over multiple checkboxes, you can not do that. If you have one checkbox selected and clicking another checkbox results in the first being un-checked, then you have an implementation issue which we can't help you with until you show us exactly what is being done to determine the state of the checkboxes in your dataset.
The table is populated with this named query:
0 "select" is the checkbox column
SELECT A.ASSET "text",
0 "select",
TO_NUMBER(APA.PARENTASSET) "Zone",
TS.ID_SEDE AS "id"
...
wich is render as a boolean checkbox as Transistor taught me
And so what do you expect to happen when you "check" a checkbox?
When you edit a cell you need to Configure Event to update the props.data
.
self.props.data[event.row][event.column] = event.value
That will update the table.
It will not generate the list of selected items for you. You will have to do that separately.
I think it's time you spend some time at
I put my named query return format as json
and added
self.props.data[event.row][event.column] = event.value
to my onEditCellCommit Event
but still cant choose multimple checkboxes on my table
I'm not surprised because the Table is bound against a Named Query. You need to use that onEditCellCommit Event to update the underlying data being queried, not write back to data which will be overwritten by a binding.
Your data, as a JSON object, should look like this:
The script self.props.data[event.row][event.column] = event.value
changes this value:
for each checkbox
selected.
Then, in a separate script, such as a button event, you can collect all the "selected" rows by (I think) using a Py dataset
and sending that data to where it needs to go.
@Alejandro_Alaco This is the code I wrote to use an SQL INSERT
statement to insert into some random table:
def runAction(self, event):
set1 = self.parent.custom.data_out
set2 = {}
for row in set1:
if row['Checkbox'] == True:
set2['Checked'] = row['Checkbox']
set2['ID'] = row['SectionID']
set2['Name'] = row['SectionName']
query = "TEST/Insert_Table4"
params = {"p_Checked":set2['Checked'], "p_ID":set2['ID'], "p_Name":set2['Name']}
system.db.runNamedQuery(query, params)