Search code examples
csstwitter-bootstrapxpages

XPages / CSS / Bootstrap Issue


Hopefully a simple one to answer and just me getting tunnel vision...

I have a button defined as <xp:button value="Back" id="button1" styleClass="btn-test-header">

But when rendered, it outputs the class as class="btn-test-header btn btn-default"

Why and how is it always appending btn btn-default? Not matter what class I give it, in the browser, it always get this style.....

I have nothing in my theme to say always use that class......


Solution

  • Bootstrap3_flat.theme has the following settings:

    <!-- XPages Buttons -->
    <control>
        <name>Button</name>
        <property mode="concat">
            <name>styleClass</name>
            <value>btn btn-default</value>
        </property>
    </control>
    
    <control>
        <name>Button.Command</name>
        <property mode="concat">
            <name>styleClass</name>
            <value>btn btn-default</value>
        </property>
    </control>
    
    <control>
        <name>Button.Submit</name>
        <property mode="concat">
            <name>styleClass</name>
            <value>btn btn-primary</value>
        </property>
    </control>
    
    <control>
        <name>Button.Default</name>
        <property mode="concat">
            <name>styleClass</name>
            <value>btn btn-default</value>
        </property>
    </control>
    
    <control>
        <name>Button.Cancel</name>
        <property mode="concat">
            <name>styleClass</name>
            <value>btn btn-default</value>
        </property>
    </control>
    

    See https://github.com/OpenNTF/XPagesExtensionLibrary/blob/master/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.theme.bootstrap/src/com/ibm/xsp/theme/bootstrap/themes/Bootstrap3_flat.theme#L238. If you override these settings in your theme, that may address it, I'm not sure.