简体   繁体   English

KendoUI Splitter打破了引导程序样式

[英]KendoUI Splitter breaks bootstrap styles

I have some HTML I am appending to the KendoUI Splitter container, and it has bootstrap css assigned to it. 我有一些HTML我附加到KendoUI Splitter容器,它有分配给它的bootstrap css。 The styles work fine when the HTML is outside the splitter, but they break when inside the splitter. 当HTML在拆分器外部时,样式工作正常,但在拆分器内部时它们会中断。

How can I solve this? 我怎么解决这个问题?

Here is a simple fiddle that demonstrates the issue: http://jsfiddle.net/codeowl/9Ag3X/17/ 这是一个简单的小提琴,演示了这个问题: http//jsfiddle.net/codeowl/9Ag3X/17/

Here is the code: 这是代码:

<div class="spacer"></div>

<div id="StandardDiv">    
</div>

<div class="spacer"></div>

<div id="splitter" 
    data-role="splitter"
    data-panes="[
        { collapsible: false, size: '30px' },
        { collapsible: false }
    ]">
    <div id="LeftPane"></div>
    <div id="RightPane"></div>    
</div>


<script id="TestTemplate">
    <div class="panel panel-default">
        <div class="panel-heading ma-panel-heading">Edit User Details:</div>
        <div class="panel-body">
            <table class="form-uiview-add_edit">
                <tr>
                    <td>
                        <label >Username:</label>
                        <input type="text" class="form-control"  />
                    </td>
                    <td>
                        <label >Password:</label>
                        <input type="password" class="form-control"  />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label >First Name:</label>
                        <input type="text" class="form-control" />
                    </td>
                    <td>
                        <label >Last Name:</label>
                        <input type="text" class="form-control" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <label >Email:</label>
                        <input type="text" class="form-control" />
                    </td>
                    <td>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" value="1" />
                                Account is Active
                            </label>
                        </div>
                    </td>
                </tr>
            </table>
            <div class="pull-right">
                <button class="btn btn-default" >
                    Cancel
                </button> 
                <button class="btn btn-default" >
                    Save
                </button>
            </div>
        </div>
    </div>   
</script>

Here is the Javascript: 这是Javascript:

$(document).ready(function() {
    var eTestTemplate = $('#TestTemplate');
    $('#StandardDiv').append(eTestTemplate.html());
    kendo.bind($('#splitter'), {});
    $('#RightPane').append(eTestTemplate.html());
});

Here is the CSS: 这是CSS:

table.form-uiview-add_edit {
    width:100%;
}
.form-uiview-add_edit td {
    padding:5px;
}
.spacer {
    height:20px;
}

Using the Chrome developer tools I have found that once rendered the splitter panel div gets assigned the k-widget class. 使用Chrome开发人员工具,我发现一旦渲染了分割器面板div,就会分配k-widget类。 If I edit the div in the dev tool and and remove the k-widget class, the form shows as it should, with the 5px padding in the table cells putting space between the text inputs. 如果我在开发工具中编辑div并删除k-widget类,则表单显示应该使用表格单元格中的5px填充,在文本输入之间放置空格。

But I have not yet narrowed down exactly what it is in the k-widget class that breaks the bootstrap styles. 但是我还没有缩小它在k-widget类中打破引导样式的确切内容。

Thank you for your time, 感谢您的时间,

Regards, 问候,

Scott 斯科特

Ok I solved the problem! 好的,我解决了这个问题!

The k-widget class assigns the following css: k-widget类分配以下css:

.k-widget, .k-widget * {
    -moz-box-sizing: content-box; 
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
}

These styles break the padding in the table and the bootstrap styles. 这些样式打破了表中的填充和引导样式。

I resolved this with the following css on my form: 我在表单上用以下css解决了这个问题:

.form-uiview-add_edit * {
    -moz-box-sizing: border-box !important; 
    -webkit-box-sizing: border-box !important; 
    box-sizing: border-box !important;
}

Here is the updated fiddle: http://jsfiddle.net/codeowl/YV8Jx/4/ 这是更新的小提琴: http//jsfiddle.net/codeowl/YV8Jx/4/

Hopefully this saves someone else some time. 希望这能节省别人一些时间。

Regards, 问候,

Scott 斯科特

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM