Deleting rows from QueryWebPart with a non-table query

LabKey Support Forum (Inactive)
Deleting rows from QueryWebPart with a non-table query Will Holtz  2016-10-11 11:47
Status: Closed
 
Hi,

I have a hard table that I wrap in a simple query to add a new static column that will be used to create a hyperlink (analogous to the 'Details' column). I have a .sql and .query.xml file for this query and in the query metadata I use the <deleteUrl> tag to point a URL for performing a row deletion on the original hard table using /query/deleteQueryRows.view. When I use LABKEY.QueryWebPart to display a grid of the query, I cannot get the delete button to show up. I get an error displayed below the grid header of 'WARNING: button bar configuration contains reference to buttons that don't exist. Invalid original text: delete.' Is this expected behavior? If so, is there another simple way to get the indirect delete behavior short of adding my own delete button with a custom js action?

I have attached a minimal file based module that demonstrates the issue. After the module has been installed and instantiated in a folder, add the 'MoleculePlusGrid' webpart to a page to get the error. I am running this on v16.2 and the module is configured for Postgres only.

Thanks!
-Will
 
 
jeckels responded:  2016-10-12 11:32
Hi Will,

Custom queries are considered read-only, which is why can't reuse the Delete button that's available on "real" tables. You could certainly add a Delete button that performs the delete against the source table.

However, an easier approach would likely be to add a wrapped column to the source table that injects your custom column. It could use a simple custom renderer by pointing at a custom DiplayColumnFactory. This would let you target the real table, so the regular delete button would be available.

Attached is an example .query.xml file that does this kind of configuration.

Thanks,
Josh