Selections on checkbox icon

Here is the example , we have table wth check box icon view on table and I have a doubt like how when we select the checksboxex then particular row will selected..... and data in table coming from database table via named query.

Not gonna work. I think the selection properties of the perspective table are read only... which mean you can't select something programmatically. Not with built-in ways.
BUT, since everything is possible, there are alternatives. The simplest one is probably to maintain a list of ids corresponding to the selected rows, then you can do whatever you want with those ids.

What's your end goal ? What happens to the selected rows ?

delete after selected rows

Delete from the database ?
Then indeed, maintain a list of the records that need to be delete, then when the user clicks the delete button, use those in your query. Then use refreshBinding to update the table.

we have done for the multiselection and deleton through buttoon .......my query is when we click selected check box then particular row will selected then action performed of deletion

You'll need to be more specific than that, because as it is I believe I already answered that question.
edit: Actually you don't even need to maintain a list, just build it from the rows that have been selected when the button is clicked.
Loop through your data and filter the ones where the checkbox is checked.

how we implement through script can you give some idea on that?

items_ids = [row['id'] for row in table.props.data if row['selected']]
2 Likes

could you give more info about script where to improve ......we have done script on button for mutiselection its work.....for above script you send me where and how we implement ?

If you want more info... You'll have to give more info.

Likewise we have information that - we want to select the rows such that on clicking the checkbox, the table selection data should append and not on the row click. Thereafter i will delete the rows which are there in the table.selection.data on click of a button.

This is not possible. You can only change the table's native row selection with its own click/shift-click/ctrl-click user interface. If you want checkboxes within each row to carry the selection information, you will need to maintain all of that selection information yourself. And disable the table's own selection feature.

Again, don't use the built-in selection.data. If you're not using the built-in selection mechanism, then the built-in data will not reflect your selection.

I'll try to make it as clear as possible:
Your table contains data. In each row, you have a checkbox. If you want to find the rows where the checkbox has been checked, just iterate over the data and, for each row, check if the box is checked. If it is, take the id of the row. This is what the code I posted previously does.

On the button's actionPerformed event, add a script that will look like this:

selected_ids = [row['id'] for row row in table.props.data if row['selected']]
runQuery("delete_things", {'ids': selected_ids})

This is ONLY to give you an idea of where to go next, there are a few things wrong with this script, that you will have to fix yourself (or give us enough details so that we can be more specific):

  • the table's path will need to match your actual table's path
  • row['id'] will need to be changed to whatever is used to identified records in your database table
  • row['selected'] will need to be changed to whatever your checkbox's column is
  • runQuery is only a placeholder, as I don't know what mechanism you use run the query