I'm going through and making adjustments to existing VF pages to look good in lightning. One issue I'm running into is that it seems apex:dataTables persistently want to span the width of the frame they are in. If I set width="50%" or style="width:50%", they still continue to span the entire width, but somehow look even worse. What could it be in LEX stylesheets that I need to override to disable this behavior?
I would like each column of my table to simply stack next to the previous one so that it essentially uses the expected cellspacing of the table. Classic demonstrates this desired effect. You can see it becomes ridiculously spaced out in LEX. I'm sure I'm missing something basic here...
Thanks for the help!
UPDATE:
Here is the code I'm working with (as updated per suggestion in response):
<!--div class="slds-grid">
<!--div class="slds-size_1-of-2"-->
<apex:dataTable value="{!rules}" var="rw" cellspacing="4" rendered="{!rules.size > 0}">
<apex:column style="text-align:center; vertical-align:middle" width="12px">
<apex:outputText value="{!rw.slot}" style="font-weight:bold"/>
</apex:column>
<apex:column style="vertical-align:middle">
<apex:facet name="header">{!q.ObjectLabel__c} Field</apex:facet>
<apex:selectList value="{!rw.r.Lead_Field__c}" style="height:20.25px" size="1">
<apex:selectOptions value="{!fieldNames}"/>
<apex:actionSupport event="onchange" rerender="filters,messages" status="blackout"/>
</apex:selectList>
</apex:column>
<apex:column style="vertical-align:middle">
<apex:facet name="header">Operator</apex:facet>
<apex:selectList value="{!rw.r.Operator__c}" style="width:162px; height:20.25px" size="1">
<apex:selectOptions value="{!rw.operators}"/>
<apex:actionSupport event="onchange" rerender="filters,messages" status="blackout"/>
</apex:selectList>
</apex:column>
<apex:column style="vertical-align:middle">
<apex:facet name="header">Value</apex:facet>
<apex:inputField value="{!rw.r.TextValue__c}" style="width:250px" html-placeholder="{!rw.idsOnly}" rendered="{!rw.r.Operator__c == 'equals' || rw.r.Operator__c == 'not equal to'}"/>
<apex:outputPanel styleClass="requiredInput" layout="block" rendered="{!rw.r.Operator__c != 'equals' && rw.r.Operator__c != 'not equal to'}">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputField value="{!rw.r.TextValue__c}" style="width:250px" html-placeholder="{!rw.idsOnly}"/>
</apex:outputPanel>
</apex:column>
<apex:column style="text-align:center; vertical-align:middle">
<apex:commandLink type="image/png" action="{!deleteRule}" immediate="true" rerender="filters,messages" status="blackout">
<apex:image value="{!$Resource.DeleteIcon}" style="width:12px; height:12px" title="Delete filter"/>
<apex:param name="deleteLine" value="{!rw.slot}" assignTo="{!deleteLine}"/>
</apex:commandLink>
</apex:column>
</apex:dataTable>
<!--/div>
<!--/div-->
With the divs uncommented, this is the result:
You can see how each column now has an (unwelcome) even width, and is ignoring the widths specified (regardless of whether the width is set via CSS within the column's component, or as an attribute of the column).
To reiterate, classic's natural way of handling the column width/spacing is what I'm going for (width is honored, spacing is small and consistent). Thanks!