I have a kendoToolbar with 3 button
s in it and a label
, chances are in the end I'll end up adding another button
or a dropdown menu in it for exporting the grid data, anyhow..
I was wondering how I can make the bootstrap label
fill up the remaining area of the toolbar. Reason being is because when a user navigates to this grid I would like them to know where they are.
Right now it looks like this:
And this is how I am wanting it to look like
Right now my code looks like this:
$("#customerToolbar").kendoToolBar({
items: [
{
template: " <button type='button' id='AddRecord' onClick='CustomerPopupEditor()' class='btn btn-primary'><span class='glyphicon glyphicon-plus'></span> Add</button>  "
},
{
template: "<button type='button' id='edit' class='btn btn-warning myEdit'><span class='glyphicon glyphicon-edit'></span> Edit</button>  "
},
{
template: "<button type='button' id='delete' class='btn btn-danger myDelete'><span class='glyphicon glyphicon-remove'></span> Delete</button>"
},
{
template: "<div class='label label-success'>Customers</div>"
}
]
});
and here is dojo
EDIT
It doesn't necessarily need to be a label
either to fill up the remaining space of the toolbar, it can be anything that will give the similar effect to what I want it to look like.
Using flexbox
you can achieve this.
Toggle full-page to see result.
NOTE: I used body
in CSS to override the already used CSSs without using !important
.
/*CSS changes*/
body .k-toolbar {
display: flex;
}
body .k-toolbar .k-button,
body .k-toolbar > * {
display: flex;
margin: 0 1%;
}
body .k-toolbar-last-visible {
flex: 1;
align-items: center;
}
body .label {
flex: 1;
padding: 1.5em
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.2.607/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.2.607/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.2.607/styles/kendo.default.min.css">
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.2.607/styles/kendo.mobile.all.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="http://kendo.cdn.telerik.com/2016.2.607/js/angular.min.js"></script>
<script src="http://kendo.cdn.telerik.com/2016.2.607/js/jszip.min.js"></script>
<script src="http://kendo.cdn.telerik.com/2016.2.607/js/kendo.all.min.js"></script>
<div id="customerToolbar">
</div>
<!-- Script -->
<script>
$("#customerToolbar").kendoToolBar({
items: [{
template: " <button type='button' id='AddRecord' onClick='CustomerPopupEditor()' class='btn btn-primary'><span class='glyphicon glyphicon-plus'></span> Add</button>  "
}, {
template: "<button type='button' id='edit' class='btn btn-warning myEdit'><span class='glyphicon glyphicon-edit'></span> Edit</button>  "
}, {
template: "<button type='button' id='delete' class='btn btn-danger myDelete'><span class='glyphicon glyphicon-remove'></span> Delete</button>"
}, {
template: "<div class='label label-success'>Customers</div>"
}]
});
</script>