【问题标题】:Cannot set width in qweb无法在 qweb 中设置宽度
【发布时间】:2018-05-09 08:47:08
【问题描述】:
<div class="row" style="border:1px solid black;">
    <table class="table table-condensed" >
        <thead style="border: 1px solid black;">
            <tr>
                <th class="text-left" width="5%" style="border-left:1px solid black;">Sl no</th>
                <th class="text-center" style="border-left:1px solid black;">Account</th>
                <th class="text-center" style="border-left:1px solid black;">Partner</th>
                <th class="text-center" style="border-left:1px solid black;">Internal Reference</th>
                <th class="text-center" style="border-left:1px solid black;">Description</th>
                <th class="text-center" style="border-left:1px solid black;">Debit Amount(AED)</th>
                <th class="text-center" style="border-left:1px solid black;">Credit Amount(AED)</th> 
            </tr>
        </thead>
        <tbody style="border-bottom: 1px solid black;">
            <t t-set="count" t-value="1"/>
            <tr t-foreach="o.line_ids" t-as="l" style="border-top: 1px solid black;">
                <td  class="text-left" width="5%"><span t-esc="count"/> <t t-set="count" t-value="count + 1"/></td>
                <td class="text-left" style="border-left:1px solid black;"><span t-field="l.account_id.name"/></td>
                <td class="text-left" style="border-left:1px solid black;"><span t-field="l.partner_id"/></td>
                <td class="text-left" style="border-left:1px solid black;"><span t-field="l.account_id.code"/></td>
                <td  class="text-left" style="border-left:1px solid black;"><span t-field="l.name"/></td>
                <td  class="text-right" style="border-left:1px solid black;"><span t-field="l.debit"/></td>
                <td  class="text-right" style="border-left:1px solid black;"><span t-field="l.credit"/></td>
            </tr>
<tr>
    <td style="display:inline;border-left:1px solid black;border-top:1px solid black;">
        <span t-if="o.ref">
        <span>Reference:</span><span><span   t-field="o.ref"/></span>
        </span>
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
    <td style="border-top:1px solid black;">
    </td>
</tr>

        </tbody>                            
    </table>
 </div>

您好,上面是我的 xml 代码。我面临的问题是我无法为Sl No 列设置宽度我尝试将width="5%" 放入thtd 中,我还尝试将其放入style 中,如style="width:5%" 但这也可以不行。请帮忙 。 提前谢谢...

【问题讨论】:

    标签: odoo odoo-10 qwebview qweb


    【解决方案1】:

    th 的宽度将被正确设置。问题应该是宽度的值,5% 可能不足以在同一行显示Sl No

    试试

    <tr>
        <td colspan="7" style="display:inline;border-left:1px solid black;border-top:1px solid black;">
            <span t-if="o.ref">
                <span>Reference:</span><span><span t-field="o.ref"/></span>
            </span>
        </td>
    </tr>
    

    【讨论】:

    • 那么你会推荐多少%? @zety
    • 7% 应该足够了。
    • 添加了一个新的 .. 是不是因为这个?
    • 不,width 会影响行数。
    • 行数应该是行数+1(循环外的最后一行)。
    猜你喜欢
    相关资源
    最近更新 更多
    热门标签