Best way to manipulate QueryWebPart buttonbar buttons?

LabKey Support Forum (Inactive)
Best way to manipulate QueryWebPart buttonbar buttons? tstellin  2013-01-09 12:35
Status: Closed
 
Hello,

I'm writing a file-based module that uses a QueryWebPart. The requirements ask for one of the QueryWebPart's buttons (as defined by the QueryWebPart's buttonBar config) to be disabled/enabled based on the presence of another object in the dom. What's the best way to enable or disable a specific QueryWebPart button?

Thanks,
-Tobin
 
 
Nick Kerr responded:  2013-01-09 18:02
Hi Tobin,

Unfortunately, there is not a real good way to access the rendered button as we only provide a click handler.

However, there are couple of injection options:

1. Using the onRender callback from the button bar configuration you could inject your own buttons and still have access to the DataRegion object and control over the buttons state.

2. Turn your button into a menu using the <item> property on <ButtonBarItem> and inject menu items onRender.

On our side, we should probably look at providing a DOM id for these generated buttons so they would be easier to have control over in an onRender event.

Thanks,
Nick
 
tstellin responded:  2013-01-10 07:51
Alright. I'll try implementing (1)--that seems pretty reasonable.

Thanks!
-Tobin