Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
Selectable Tecton data Table in form_fields for online extension

For a selectable (multiple selection) data table, when the form is submitted, I am not seeing the selected checkboxes in the self.form_fields data in my extension's method. I believe I need to add the name attribute to the checkboxes. Do I need to add the name attribute in javascript, or is there a more native way provided that I am missing?

For example,
jinja2 has ....
<q2-data-table name="accts" caption="Accounts" empty-icon="warning" empty-message="Nothing to display" select-mode="multiple" selectable="true">
</q2-data-table>

extension.py
async def submit(self):
selected_accounts=self.form_fields.get('accts') #This is not there

Thanks!

Posted 11 months ago
Votes Newest

Answers


Hi Bina, currently we don't have a good way to get the checked value with the form submit.
You can listen the select event and store the checked values every time user click the checkboxes

const dt = document.querySelector("your-datatable-selector");
dt.onselect = function(e) { 
    console.log(e.detail.id, e.detail.selected);
		// do more stuff like store the values then pass the combined values into the form 
}

Also you can still get the values using javascript then you can pass the values with your own fields or hidden fields before submit happens.

const dt = document.querySelector("your-datatable-selector");
const ids = dt.rows.filter(row => dt.shadowRoot.querySelector(`#row-${row.id} q2-checkbox[checked]`)).map(row => row.id);

We'll open a ticket to provide a better way to get the checked values with the self.form_fields in the extension.py
Let me know if you have any questions.

Thanks
Alex

Posted 10 months ago
Alex Jeong
60 × 1 Administrator
0

Thanks, Alex!

— Bina Reed   10 months ago
103 Views
1 Answer
11 months ago
10 months ago