Kendo UI 2015.2.805
I want to add a separator line between menu items on the toolbars's split button dropdown. I know how to add a separator line between toolbar buttons, as shown below, but it does not work for the menuButtons array.
$("#my_toolbar").kendoToolBar({
items: [
{ type: "button", text: "Option 1" },
{ type: "separator"},
{ type: "button", text: "Option 2" },
{ type: "splitButton", text: "Actions",
menuButtons: [
{ id: "button_3", text: "Option 3" },
{ id: "button_4", text: "Option 4" },
//separator here
{ id: "button_5", text: "Option 5" },
{ id: "button_6", text: "Option 6" }
]
}
]
});
`
How to add separator at the comment?
RESOLVED:
Posting David's solution here from his link so it's persisted. I needed to style the .no-button in my environment to collapse it to a line. Perfect.
.no-button { padding: 0;}
menuButtons: [
{ id: "button_3", text: "Option 3" },
{ id: "button_4", text: "Option 4" },
{ enable: false, attributes: { class: "no-button"} },
{ id: "button_5", text: "Option 5" },
{ id: "button_6", text: "Option 6" }
]
There is no OOTB way to do this. There are a few hacky ways to do it with your own markup. For example you can do something like this:
$("#my_toolbar").kendoToolBar({
items: [
{ type: "button", text: "Option 1" },
{ type: "separator"},
{ type: "button", text: "Option 2" },
{ type: "splitButton", text: "Actions",
menuButtons: [
{ id: "button_3", text: "Option 3" },
{ id: "button_4", text: "Option 4" },
{ text: "<hr style='margin:0px; padding:0px; color:#d8d8d8;' />", enable: false },
{ id: "button_5", text: "Option 5" },
{ id: "button_6", text: "Option 6" }
]
}
]
});
The only problem with this is that it will get highlighted if you scroll over it, because it will get wrapped in an anchor element when it gets rendered. If that bothers you, then you could give the hr an id and then use JavaScript to find it, get its parent, and modify the css of the anchor.
Related
I'm using a bootstrap table, but the design is not responsive, and every box has an overflow issue. I want to set overflow:'hidden, but I'm not sure where to put the CSS for the table, so I've provided the following code.
const columns = [
{
dataField: "service_description",
text: "SERVICE NAME",
},
{
dataField: "service_infra",
text: "INFRA",
sort: true,
},
{
dataField: "data_center",
text: "DATA CENTER",
sort: true,
},
{
dataField: "cloud_provider",
text: "CLOUD PROVIDER",
sort: true,
},
{
dataField: "infra_location",
text: "Infra Location",
},
];
return (
<div>
<BootstrapTable
bootstrap4
keyField="tenant_service_id"
data={serviceData}
columns={columns}
pagination={paginationFactory({ sizePerPage: 5 })}
/>
</div>
);
My problem is included in a screenshort.
Below is what my table looks like in code. How can i control each column and make them have different widths?
{ id: 1, name: "Item 1", price: 100 },
{ id: 2, name: "Item 2", price: 102 }
];
const ProductList = props => {
const columns = [
{
dataField: "id",
text: "Product ID"
},
{
dataField: "name",
text: "Product Name"
},
{
dataField: "price",
text: "Product Price"
}
];
return (
<div style={{ padding: "20px" }}>
<h1 className="h2">Products</h1>
<BootstrapTable keyField="id" data={products} columns={columns} />
</div>
);
};```
You can use style prop
{
dataField: "name",
style: {
width: '90px'
}
text: "Product Name"
}
While surfing and searching for the solution, i stumbled upon their well documented doc page. Initially, it's the name react-bootstrap-table-next that was confusing me: it is well known as react-bootstrap-table2.
So, to control the width of a react-bootstrap-table-next table column, you should add classes props to style it externally or style to use inline style. Both props have the capability to take a callback function to better manipulate it.
The code will now look like below:
Here manipulating the width of the first column:
const ProductList = props => {
const columns = [
{
dataField: "id",
text: "Product ID",
style: {
width: '12em',
}
},
{
dataField: "name",
text: "Product Name"
},
{
dataField: "price",
text: "Product Price"
}
];
return (
<div style={{ padding: "20px" }}>
<h1 className="h2">Products</h1>
<BootstrapTable keyField="id" data={products} columns={columns} />
</div>
);
};
The storybook is pretty straight forward.
Just give the width to columns
const columns = [
{
dataField: "id",
text: "Product ID",
style:{'width' : '90px'}
},
{
dataField: "name",
text: "Product Name",
style:{'width' : '90px'}
},
{
dataField: "price",
text: "Product Price",
style:{'width' : '90px'}
}
];
screen
I want this look when I switch to viewing the "agenda one day".
What i'm need to configure in the configuration for this view.
UPD: version 3.9
UPD2:
sandbox there
this config file (short version):
const config = {
header: false,
schedulerLicenseKey: "GPL-My-Project-Is-Open-Source",
defaultView: "agendaOneDay",
slotDuration: "00:15:00",
columnFormat: "ddd, DD MMM",
editable: false,
selectable: true,
groupByResource: true,
views: {
agendaOneDay: {
type: "agenda",
duration: { days: 1 },
buttonText: "1"
},
agendaThreeDay: {
type: "agenda",
duration: { days: 3 },
buttonText: "3"
}
},
resources: [
{ id: 5128, title: "Test title 1", eventColor: "#5eb15e" }
],
events: [
{
start: "2018-09-24T09:00:00.000Z",
end: "2018-09-24T09:30:00.000Z",
resourceId: 5128,
title: "test 1",
event: {},
color: "",
textColor: "#191919"
},
{
start: "2018-09-26T09:00:00.000Z",
end: "2018-09-26T09:30:00.000Z",
resourceId: 5128,
title: "test 1",
event: {},
color: "",
textColor: "#191919"
}
]
};
I'm trying to do a dropdown menu with for each button in it, a link to a page.
I made the following code but I'm not able to create some link inside, i get an error each time :
Ext.create('Ext.menu.Menu', {
layout: 'hbox',
width: 500,
height: 40,
margin: '10 0 0 10',
renderTo: Ext.getBody(),
floating: false,
items: [{
text: 'Home'
},
{
text: 'Inventory',
menuAlign: 'tr-br',
menu:{
items:[
{
text: 'Show',
},
{
text: 'Search'
},
{
text: 'Service Catalog'
}
]
}
},
{
text: 'Request',
menuAlign: 'tr-br',
menu:{
items:[
{
text: 'New Request'
},
{
text: 'My requests'
}
]
}
},
{
text: 'Management',
menuAlign: 'tr-br',
menu:{
items:[
{
text: 'Sites'
},
{
text: 'Users'
},
{
text: 'Stocks'
},
{
text: 'Export'
}
]
}
},
]
});
Does anyone know how to create link in a button ?
Solution find :
I just added a handler in my code :
{
text: 'Search',
handler : menuH
},
and the handler :
var menuH = function() {
window.location = "/myapplication";
}
I have kendo tree-view in my application,I want to apply the styles for kendo tree-view parent node only.How to apply the styles like Font weight-bold for the parent node of tree-view?
My treeview code is
var tree= $("#treeview").kendoTreeView({
checkboxes: {
checkChildren: true
},
dataSource: [{
id: 2, text: "select all", expanded: true,
items: [
{ id: 3, text: "ABH" },
{ id: 4, text: "VFG" },
{ id: 5, text: "VFGT" },
{ id: 6, text: "GTYUJ" },
{ id: 7, text: "GHJ" }
]
}]
}).data("kendoTreeView");
here is the JSfiddle.
Try to configure this in scripts.
.k-top.k-bot {font-weight: bold;}