The YUI MenuBar seems to have an issue with being below a header.
HTML:
<body class="yui-skin-sam">
<a id="headerStyle"><img href="/" src="/images/Header.jpg" alt="Home"/></a>
<div id="menuPanel" style="padding:1px">
CSS:
#headerStyle {
position:relative;
width:600px;
height:100px;
}
Javascript:
var oMenu = new YAHOO.widget.MenuBar("mymenu");
oMenu.addItems([
{
text: "Main",
submenu: {
id: "menu1",
itemdata: [
{ text: "1" },
{ text: "2" },
{ text: "3" },
{ text: "4" },
{ text: "5" },
{ text: "6" },
{ text: "7" },
{ text: "8" }
]
}
}
]);
oMenu.render($("#menuPanel").get(0));
oMenu.show();
Clicking MenuBar for the first time, it displays only 3 items with scrolling.
The issue goes away after the first click.
Any ideas?
Specifying the height property in the CSS file seems to cause this issue.
Simple removing it makes it function as it should.
Related
In the example: http://jsbin.com/AreqameT/1/edit Can the labels below the bar chart made clickable in kendo charts?
The text "Sales and Contracting" and other labels should be made clickable. Can this be done?
JS code:
$("#chart").kendoChart({
legend: {
position: "bottom"
},
seriesDefaults: {
labels:{
visible:true,
template: '#=kendo.format("{0:0}", value)#'
}
},
series: [
{
type: "verticalBullet",
currentField: "score",
targetField: "average",
labels: {
visible: true,
template: '#alert(1)#"'
},
target: {
color: "transparent",
border: {
width: 2,
dashType: "dot",
color: "#444"
},
line: {
width: 0
}
},
data: [
{
score: 93.7,
average: 65.2
}, {
score: 80.2,
average: 22.2
}, {
score: 60.8,
average: 35.2
}, {
score: 82.1,
average: 45.2
}, {
score: 74.2,
average: 55.2
}
]
}
],
categoryAxis: {
labels: { rotation: -45 },
categories: ["Sales & Contracting", "Implementation & Training", "Functionality & Upgrades", "Service & Support", "General"],
line: {
visible: false
},
color: "#444",
axisCrossingValue: [0, 0, 100, 100]
},
tooltip: {
visible: false
}
}).data("kendoChart");
HTML code:
<body>
<div id="chart"></div>
</body>
Thanks in advance.
Using a newer version of Kendo (your jsBin uses a 2013 version... update to 2014.2) you can use categoryAxis.labels.template to add a link to your labels.
categoryAxis: {
labels: {
rotation: -45,
template: '<a xlink:href="http://www.google.com">#: value #</a>'
},
(note the addition of xlink: in the tag)
To better explain, the labels are actually part of an SVG image, not plain HTML. However, SVG supports links: http://www.w3.org/TR/SVG/linking.html#Links
For some reason the older 2013 version of Kendo seem to remove the link from the template though. I tried it with 2014.2.716 and it seemed to work.
Your Jsbin eg not working. Attach a event axisLabelClick or legendItemClick
axisLabelClick: function(e) {
console.log(e.axis.type, e.value);
}
legendItemClick: function(e) {
console.log(e.axis.type, e.value);
}
this might work
I have a kendo grid with frozen column & inline editing is enabled, first column is frozen and rest all columns are editable and all have checkboxes. the issue is when I edit any row and click edit button of any other row then both rows appear editable.
I only want the current row to be editable.
Without freezing any column it works but if I used locked:true for any column it does not work.
It seems to work as expected here: http://trykendoui.telerik.com/#korchev/aSIp
This is the code I've tried:
<div id="grid" style="width: 400px"></div>
<script>
$("#grid").kendoGrid({
columns:[{
field: "foo",
locked: true,
width: 100
}, { field: "bar", width: 200 },
{ command: "edit", width: 200 }
],
dataSource: {
data: [
{ id:1, foo: "foo1", bar: "bar1" },
{ id:1, foo: "foo2", bar: "bar2" }
],
schema: { model: { id: "id" }}
},
editable: "inline"
})
</script>
I have a tree view, with dragAndDrop set to true. When a leaf node of the tree is converted into an internal node, by dropping some child in it, it starts to behave strangely. If I collapse this node, it won't expand again. It gets even weirder if I drop another child to it. Here is the code I used:
var inline = new kendo.data.HierarchicalDataSource({
data: [
{ categoryName: "Storage", subCategories: [
{ subCategoryName: "Wall Shelving" },
{ subCategoryName: "Floor Shelving" },
{ subCategoryName: "Kids Storage" }
] },
{ categoryName: "Lights", subCategories: [
{ subCategoryName: "Ceiling" },
{ subCategoryName: "Table" },
{ subCategoryName: "Floor" }
] }
],
schema: {
model: {
children: "subCategories"
}
}
});
$("#label-tree").kendoTreeView({
dragAndDrop: true,
loadOnDemand: false,
dataSource: inline,
dataTextField: [ "categoryName", "subCategoryName" ]
});
I tried other ways of defining the datasource, but they end up the same. Am I doing it wrong?
This was a bug in Kendo UI but was solved in version 2013.1.514. Trying using:
<link href="http://cdn.kendostatic.com/2013.1.514/styles/kendo.common.min.css" rel="stylesheet">
<link href="http://cdn.kendostatic.com/2013.1.514/styles/kendo.default.min.css" rel="stylesheet">
<script src="http://cdn.kendostatic.com/2013.1.514/js/jquery.min.js"></script>
<script src="http://cdn.kendostatic.com/2013.1.514/js/kendo.all.min.js"></script>
How can I write this in javascript instead of using the MVC Wrapper?
#(Html.Kendo().Grid(Model.List)
.Name("grid")
.Columns(c => {
c.Bound(e => e.ID);
c.Bound(e => e.Nom).HeaderHtmlAttributes(new { colspan = 2 });
c.Bound(e => e.Nb).HeaderHtmlAttributes(new { style= "display:none;" });
})
)
I started with the following code to experiment, I know it is not an exact
match to the attributes mentioned above, but how can I set
HeaderHtmlAttributes and Headertemplate for columns with javascript for the Kendo grid?
$("div#kendogrid").kendoGrid({
dataSource: dataSource,
columns: [
{
field: "ID",
title: "Nr Id",
headerTemplate: "sample template text col 1",
width: 100
},
{
field: "Nom",
headerAttributes: {
"class": "myHeader",
style: "text-align: right"
},
width: 200
}
]
});
You are correct, HeaderHtmlAttributes is specified using columns.headerAttributes and the equivalent to your HeaderTemplate is columns.headerTemplate. See the links for documentation:
http://docs.kendoui.com/api/web/grid#columnsheaderattributes-object
http://docs.kendoui.com/api/web/grid#columnsheadertemplate-string
The translation of your original code would be:
$("#kendogrid").kendoGrid({
dataSource: dataSource,
columns : [
{
field: "ID"
},
{
field : "Nom",
headerAttributes: {
colspan: 2
}
},
{
field : "Nb",
headerAttributes: {
style: "display:none"
}
}
]
});
I'm using kendoTabStrip as is shown on KendoUI Page. In my case in each div I have rendered partial view. In a few of my partial views I have additionaly kendoGrid.
Problem
When I reload page in any tab and go to tab which contain kendoGrid then it do not work correctly. For example: I'm on tab#0 and go for tab#3 which contain kendoGrid with pagination, then pagination is not display. But when I reload it then pagination works fine.
What can I do to my Grids works inside TabStrip?
Any help would be appreciated.
UPDATE
My implementation of tabstrip
$("#tabStrip").kendoTabStrip({
animation: { open: { effects: false} },
select: function (e) {
document.location.hash = 'tab-' + $(e.item).index();
}
});
var tabStrip = $('#tabStrip').data('kendoTabStrip');
var tabId = 0;
var scheduledId = 0;
if (document.location.hash.match(/tab-/) == 'tab-') {
tabId = document.location.hash.substr(5);
}
if (document.location.hash.match(/scheduled-/) == 'scheduled-') {
tabId = 1;
scheduledId = document.location.hash.substr(11);
editSchedule('/admin/Course/Scheduled/' + scheduledId + '/Edit/' );
}
tabStrip.select(tabStrip.tabGroup.children('li').eq(tabId));
So I need it to make some rewrites from controller.
To fix this problem we must change :
$("#tabStrip").kendoTabStrip({
animation: { open: { effects: false} },
select: function (e) {
document.location.hash = 'tab-' + $(e.item).index();
}
});
for:
$("#tabStrip").kendoTabStrip({
animation: { open: { effects: false} },
select: function (e) {
document.location.hash = 'tab-' + $(e.item).index();
},
activate: function(e) {
$(e.contentElement).find('.k-state-active [data-role="grid"]').each(function() {
$(this).data("kendoGrid").refresh();
});
}
});
Event activate is 'Triggered just after a tab is being made visible, but before the end of the animation'. So we must refresh our grids then becouse js counts widths of hidden elements wrong.
I put together an example of Grids working inside of a TabStrip: http://jsfiddle.net/dpeaep/SJ85S/. Maybe, I am missing part of what you are asking in your question. If so, you can modify the jsfiddle to clarify what the problem is.
HTML
<div id="tabstrip">
<ul>
<li>Grid 1</li>
<li>Grid 2</li>
<li>Grid 3</li>
</ul>
<div><div id="grid1"></div></div>
<div><div id="grid2"></div></div>
<div><div id="grid3"></div></div>
</div>
Javascript
var tabstrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");
tabstrip.select(0);
$("#grid1").kendoGrid({
columns: [
{ field: "FirstName", title: "First Name" },
{ field: "LastName", title: "Last Name" }
],
dataSource: {
data: [
{ FirstName: "Joe", LastName: "Smith" },
{ FirstName: "Jane", LastName: "Smith" }
]
}
});
$("#grid2").kendoGrid({
columns: [
{ field: "FirstName", title: "First Name" },
{ field: "LastName", title: "Last Name" }
],
dataSource: {
data: [
{ FirstName: "Betty", LastName: "Lakna" },
{ FirstName: "Fumitaka", LastName: "Yamamoto" },
{ FirstName: "Fred", LastName: "Stevenson" }
]
}
});
$("#grid3").kendoGrid({
columns: [
{ field: "Title", title: "Title" },
{ field: "Year", title: "Year" }
],
dataSource: {
data: [
{ Title: "Lost in Domtar", Year: "2012" },
{ Title: "Evergreen", Year: "2012" },
{ Title: "Fields of Yellow", Year: "2010" },
{ Title: "Where the Whistle Blows", Year: "2008" }
]
}
});