QWP custom buttons and XML metadata

LabKey Support Forum (Inactive)
QWP custom buttons and XML metadata Ben Bimber  2010-07-01 09:17
Status: Closed
 
In labkey you can now add custom buttons to a QWP and also selectively include the default buttons. Doing this in javascript is documented.

You can also create an XML file to supple metadata for a query. In this XML file, you can also add buttons, like this:

                <buttonBarOptions position="both" includeStandardButtons="false">
                    <includeScript>/EHR_Reporting/studyButtons.js</includeScript>
                    <item requiresSelection="true" text="View Chart">
                        <onClick>
                            historyHandler();
                        </onClick>
                    </item>
                </buttonBarOptions>

The above example does not include the standard buttons. Can I selectively add them back one by one, as I can in javascript? What would this syntax look like?

Thanks for the help.
 
 
jeckels responded:  2010-07-01 11:16
Hi Ben,

Yes, this was added as part of 10.2. Instead of including an <onClick> element, you'd include <originalText> instead. Its text content should be the name of the button on the default toolbar. Using the text attribute, you can choose to display it with either the same or different name.

https://www.labkey.org/issues/home/Developer/issues/details.view?issueId=10228

For example, to include the standard Export button but have it be called "Download This Content" instead, this should do the trick:

<buttonBarOptions position="both" includeStandardButtons="false">
    <item text="Download This Content">
        <originalText>Export</originalText>
    </item>
</buttonBarOptions>

I believe that the text attribute is required.

Thanks,
Josh
 
Ben Bimber responded:  2010-07-01 11:20
ok, thanks. so does it work to just do:

<item text="Export" />

assuming I dont care about changing the name?


The reason I plan to add buttons back one by one if b/c when you add a custom button, it gets put of the left-hand side of the button bar. Default buttons are to the right. Maybe this is a picky thing, but it seems like it's better to keep the default buttons in the same order and just tack on the custom ones at the end. Gives better consistency across QWPs.
 
jeckels responded:  2010-07-01 11:25
Hi Ben,

It looks like the originalText element is required. It would be a nice shortcut to enable that representation, but right now it's keying off of <originalText> to decide when to look for an existing button.

Thanks,
Josh
 
Ben Bimber responded:  2010-07-01 11:26
ok, not a big deal.